Re: Getting the return type right for SETOF

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Getting the return type right for SETOF
Дата
Msg-id 20030830135853.I74114-100000@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Getting the return type right for SETOF  ("Dan Langille" <dan@langille.org>)
Ответы Re: Getting the return type right for SETOF
Список pgsql-sql
On Sat, 30 Aug 2003, Dan Langille wrote:

> Hi folks,
>
> I'm playing with SETOF on functions.  But I can't get the return type
> correct.  What have I missed?  A cast?
>
> CREATE OR REPLACE FUNCTION elementGet (text) RETURNS SETOF
> element_type AS '
>
> select 1,
>        \'test\',
>        \'F\'
>        \'A\',
>        FALSE,
>        FALSE
> '
>     LANGUAGE sql stable;
> ERROR:  function declared to return element_type returns "unknown"
> instead of text at column 2

I think you'll need to explicitly make the three text columns text rather
than just a plain literal (so ''test''::text for example)



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Dan Langille"
Дата:
Сообщение: Getting the return type right for SETOF
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BEFORE UPDATE Triggers