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

From Lee Harr
Subject Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this
Date
Msg-id BAY2-F1357XNeNSjEWm0002f86e@hotmail.com
Whole thread Raw
Responses Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this  ("Jim Wilson" <jimw@kelcomaine.com>)
List 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


pgsql-general by date:

Previous
From: Andreas
Date:
Subject: Is there something like an dynamic view ?
Next
From: "Jim Wilson"
Date:
Subject: Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this