Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this

From: "Lee Harr" <missive(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this
Date: 2004-01-24 18:14:23
Message-ID: BAY2-F1357XNeNSjEWm0002f86e@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>Unless your function parameter is an integer you must quote it... eq:
>
>select use_two_tables('tablename');
>

Hrm... That does not work either:

# select use_two_tables('tablename');
ERROR: function use_two_tables("unknown") does not exist
HINT: No function matches the given name and argument types. You may need
to add explicit type casts.
# select use_two_tables('tablename'::text);
ERROR: function use_two_tables(text) does not exist
HINT: No function matches the given name and argument types. You may need
to add explicit type casts.

I am not really sure... just learning this, but I believe the parameter
type is tablename, right?

>>CREATE TABLE tablename( ...

>>CREATE or REPLACE FUNCTION use_two_tables(tablename) RETURNS text AS '
>>...

Do I need to cast the string to something?

# \df use_two*
List of functions
Result data type | Schema | Name | Argument data types
------------------+--------+----------------+---------------------
text | lee | use_two_tables | tablename
(1 row)

# select use_two_tables('tablename'::tablename);
ERROR: cannot cast type "unknown" to tablename
# select use_two_tables(tablename::tablename);
ERROR: column "tablename" does not exist

Thanks for your help.

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Wilson 2004-01-24 18:33:36 Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this
Previous Message Nate Teller 2004-01-24 17:49:54 failed index creation: ERROR: index_formtuple