473,394 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 1534
-----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.org devrim.gunduz~linux.org.tr
http://www.tdmsoft.com
http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBdTIVtl86P3SPfQ4RAj5vAKC2ugU2wcXHDgMMybyMqm 14L4+9UwCfUd7m
7WQxt0yl0PHuezSucptNLtE=
=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.purdue.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
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: .... ...
4
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...
2
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...
1
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...
3
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...
232
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...
5
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...
1
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) ...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.