Re: Returning a table from a function, that requires multiple selects?
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Returning a table from a function, that requires multiple selects? |
| Дата | |
| Msg-id | 9270.1567197267@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Returning a table from a function, that requires multipleselects? (Rob Sargent <robjsargent@gmail.com>) |
| Список | pgsql-general |
Rob Sargent <robjsargent@gmail.com> writes:
>> On Aug 30, 2019, at 2:09 PM, Guyren Howe <guyren@gmail.com> wrote:
>>
>> On Aug 30, 2019, at 13:03 , stan <stanb@panix.com <mailto:stanb@panix.com>> wrote:
>>> Is it possible for a function to return a table with results from multiple
>>> queries?
>> You could just return a tuple VALUES(a, b). Or you could define a type to return if you want to get fancy.
> Here I you might want VALUE(array[‘heading1’,a], array[‘heading2',b]) unless you’re certain you know which date is
which.
Yeah, that would be a good reason to return a declared composite type.
Something like
CREATE TYPE two_dates AS (start date, stop date);
CREATE FUNCTION f(...) RETURNS two_dates AS ...;
SELECT * FROM f(...);
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера