Re: PL/pgSQL: How to return two columns and multiple rows

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: PL/pgSQL: How to return two columns and multiple rows
Дата
Msg-id
3271.1434632581@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Re: PL/pgSQL: How to return two columns and multiple rows Sven Geggus <lists@fuchsschwanzdomain.de>
Re: PL/pgSQL: How to return two columns and multiple rows "David G. Johnston" <david.g.johnston@gmail.com>
"Raymond O'Donnell"  writes:
> On 18/06/2015 13:36, Sven Geggus wrote:
>> I would like to be able to do something like this:
>> 
>> select myfunc('foo','bar');
>> or
>> select myfunc(foo, bar) from foobartable;
>> or even
>> select myfunc(foo, bar), 'baz' as baz from foobartable;

> You need to do:

>    select * from myfunc('foo','bar');

That's enough to expand the output from a simple function call.  If you
want to do something like Sven's later examples, the best way is with
LATERAL:

select f.*, 'baz' as baz from foobartable, lateral myfunc(foo, bar) as f;

			regards, tom lane

В списке pgsql-general по дате отправления
От: Merlin Moncure
Дата:
От: David G. Johnston
Дата:
FAQ