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

Поиск
Список
Период
Сортировка
От Lee Harr
Тема Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this
Дата
Msg-id BAY2-F1357XNeNSjEWm0002f86e@hotmail.com
обсуждение исходный текст
Ответы Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this  ("Jim Wilson" <jimw@kelcomaine.com>)
Список 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 по дате отправления:

Предыдущее
От: Andreas
Дата:
Сообщение: Is there something like an dynamic view ?
Следующее
От: "Jim Wilson"
Дата:
Сообщение: Re: pl/pgsql docs 37.4.3. Row Types -- how do I use this