Re: RETURN QUERY in PL/PgSQL?

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: RETURN QUERY in PL/PgSQL?
Дата
Msg-id BAY114-F32617B835D1C692C89B019F94A0@phx.gbl
обсуждение исходный текст
Ответ на RETURN QUERY in PL/PgSQL?  (Neil Conway <neilc@samurai.com>)
Ответы Re: RETURN QUERY in PL/PgSQL?  (Neil Conway <neilc@samurai.com>)
Список pgsql-hackers
Hello

It is RETURN TABLE(SQL) via ANSI SQL 2003

Table function support is in patch queue:
http://archives.postgresql.org/pgsql-patches/2007-02/msg00216.php
http://momjian.us/mhonarc/patches/msg00001.html

Regards
Pavel Stehule



>In a PL/PgSQL set-returning function, returning the result set of a
>query requires a FOR loop and repeated invocations of the RETURN NEXT
>statement:
>
>    FOR x in SELECT ... LOOP
>        RETURN NEXT x;
>    END LOOP;
>
>This works, but it seems overly verbose. It occurred to me that we could
>easily add a new PL/PgSQL statement that evaluates a set-returning
>expression and adds *all* the resulting rows to the function's result
>set. For example:
>
>     RETURN QUERY SELECT ...;
>
>I'm not sure of the right name: "RETURN ROWS" or "RETURN ALL" might also
>work. Of course, this is syntax sugar (and superficial sugar at that),
>but I believe this is a fairly common requirement.

_________________________________________________________________
Citite se osamele? Poznejte nekoho vyjmecneho diky Match.com. 
http://www.msn.cz/



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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: RETURN QUERY in PL/PgSQL?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: RETURN QUERY in PL/PgSQL?