473,770 Members | 4,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

code in docs gives me an error

Hi
I tried creating the function (from sec 19.3.1). But it gives me the
following error: "ERROR: type tablename does not exist".
Any ideas of what i might be doing wrong?

CREATE FUNCTION use_many_fields (tablename) RETURNS TEXT AS '
DECLARE
in_t ALIAS FOR $1;
BEGIN
RETURN in_t.f1 || in_t.f3 || in_t.f5 || in_t.f7;
END;
' LANGUAGE 'plpgsql';


Thanks,
--Hicham

Nov 23 '05 #1
2 1564
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,

On Tue, 19 Oct 2004, Hicham G. Elmongui wrote:
I tried creating the function (from sec 19.3.1). But it gives me the
following error: "ERROR: type tablename does not exist".
Any ideas of what i might be doing wrong?
You have to write the data type while defining the function parameters.
For example,

CREATE FUNCTION use_many_fields (varchar) RETURNS TEXT AS '

....and then declare it as you've done below:
DECLARE
in_t ALIAS FOR $1;


Regards,
- --
Devrim GUNDUZ
devrim~gunduz.o rg devrim.gunduz~l inux.org.tr
http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBdTIVtl8 6P3SPfQ4RAj5vAK C2ugU2wcXHDgMMy byMqm14L4+9UwCf Ud7m
7WQxt0yl0PHuezS ucptNLtE=
=Z94K
-----END PGP SIGNATURE-----

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
"Hicham G. Elmongui" <el******@cs.pu rdue.edu> writes:
I tried creating the function (from sec 19.3.1). But it gives me the
following error: "ERROR: type tablename does not exist".
Any ideas of what i might be doing wrong? CREATE FUNCTION use_many_fields (tablename) RETURNS TEXT AS '


The example assumes you already created a table or composite type named
tablename.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
2078
by: Steven Bethard | last post by:
Can someone point me to the documentation on what's supposed to happen when you use the "for x in X:" syntax when X does not have an __iter__ method? I know that the code: >>> class S: .... def __len__(self): return 42 .... def __getitem__(self, i): return i .... >>> for x in S(): .... print x
4
4488
by: Michele Simionato | last post by:
I was browsing through the source tree of Python 2.4b2 and in Lib/bsddb/test I found a lot of interesting stuff. It seems that the support for the bsd database is much better than documented in the standard library http://www.python.org/dev/doc/devel/lib/module-bsddb.html. There are tests for locking, transactions, join, etc. Is there some documentation anywhere? I could infer what I need from the tests but maybe there is already some...
2
5095
by: New Guy | last post by:
Hello, First, I want to apologize for posting this message to multiple groups. (1) I have a hard time finding any info and (2) this is not a school assignment. I am trying to create in my Oracle test database a "time" table that would have time buckets. What I mean is that, it would have some structure like this
1
4604
by: Christopher.Becker | last post by:
When I'm running my app, I occaisonally receive this error message: PostgreSQL Error Code(1) "could not create socket: An address incompatible with the requested protocol was used" It appears to be a PostgreSQL Error, but I can't find Any documentation on it at all in the PostgreSQL docs, or webpage.  Has anyone ever scene this before or know what could be the cause?  Like I said it happens once in a while, not consistently.
3
1224
by: | last post by:
Here is an example 1) C# Programmer's Reference Old: http://msdn.microsoft.com/library/en-us/csref/html/vcrefTheClassType.asp New: http://msdn2.microsoft.com/en-us/library/0b0thckt.aspx The old reference actually gives the syntax. The new one doesn't
232
13343
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
5
7462
by: CDMAPoster | last post by:
I have changed how I get the shell path for Acrobat Reader based on code posted by John deKrafft. Does anyone see any problems with this code running on various Windows OS's? '--Begin Module Code 'Support functions and constants for reading a string from the registry 'I have modified the code posted by John deKrafft slightly '---- Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
1
2938
by: webgirl | last post by:
Hi everyone, I have a weird problem with some Word/Excel automation code that I run from Access (not sure if I should therefore post this in the Access forum..? Thought I'd try here first) Basically, the code either opens a document (if it exists) or creates it from a template if it doesn't. Docs can be Word or Excel docs. The weird part is that the code was working earlier tonight. But now it's not, not properly, anyway. Now, what...
3
2993
by: CF FAN | last post by:
cf search using verity for my web site. I actually took the code from docs on teh web and tweeked a couple things out on it. Now it is throwing errors and I can't figure out why. What is funny is what is throwing errors was taken strait from the adobe web site docs., so here is my code, I will show you the code I use to index the verity collection, and then the result page. Indexing code: <cfflush> <cfquery name="getresults"...
0
10237
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.