From: | Rob Sargent <robjsargent(at)gmail(dot)com> |
---|---|
To: | Guyren Howe <guyren(at)gmail(dot)com> |
Cc: | stan <stanb(at)panix(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Returning a table from a function, that requires multiple selects? |
Date: | 2019-08-30 20:23:32 |
Message-ID: | 4E2CEFF7-7FBF-43B2-A407-5B7A67BCA4AB@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On Aug 30, 2019, at 2:09 PM, Guyren Howe <guyren(at)gmail(dot)com> wrote:
>
> On Aug 30, 2019, at 13:03 , stan <stanb(at)panix(dot)com <mailto:stanb(at)panix(dot)com>> wrote:
>
>> I need to encapsulate, what are basically 2 related function calls into a single
>> function. The result of each of th calls is a date type.
>>
>> y current thinking is to return a 2 row table with the 2 dates in it. But, I seem to
>> be having issues getting this to work.
>>
>> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-08-30 20:34:27 | Re: Returning a table from a function, that requires multiple selects? |
Previous Message | Guyren Howe | 2019-08-30 20:09:30 | Re: Returning a table from a function, that requires multiple selects? |