Re: select into composite type / return

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: select into composite type / return
Дата
Msg-id 3718235.1616077713@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: select into composite type / return  (Torsten Grust <torsten.grust@gmail.com>)
Ответы Re: select into composite type / return  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql
Torsten Grust <torsten.grust@gmail.com> writes:
> Hi Gary,
> a shot in the dark but maybe

> SELECT id, (do_breakdown(id)).*
> FROM   ...

> already does the job?

Beware --- what that actually does is expand into

SELECT id, (do_breakdown(id)).f1, (do_breakdown(id)).f2, ...

so that the function will be invoked N times if it produces N columns.

What you generally want to do is invoke the function as a lateral FROM
item:

SELECT id, f.* FROM table AS t, LATERAL do_breakdown(t.id) AS f;

            regards, tom lane



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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: Re: select into composite type / return
Следующее
От: Gary Stainburn
Дата:
Сообщение: Re: select into composite type / return