From: | Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl> |
---|---|
To: | Jon Smark <jon(dot)smark(at)yahoo(dot)com> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Record with a field consisting of table rows |
Date: | 2011-01-14 17:55:43 |
Message-ID: | CB651D01-881E-48F8-B4B3-03091040A2E8@solfertje.student.utwente.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 14 Jan 2011, at 16:03, Jon Smark wrote:
> Hi,
>
> This thread has veered off-topic, but my original problem still remains.
> Basically, I want to declare a function that returns a tuple consisting
> of an integer and a set of table rows. Something like the following:
>
> CREATE FUNCTION foobar () RETURNS (int4, SETOF users)
>
> Now, if I understand correctly, the only way to have a function return
> a tuple is to create a named record and have the function return that
> record:
Nope, see my reply from yesterday around 20:23
You can return a table instead, with the count added as an extra column.
Alban Hertroys
--
Screwing up is an excellent way to attach something to the ceiling.
!DSPAM:737,4d308e2711871421280230!
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2011-01-14 22:21:58 | array_agg-like thing over arrays |
Previous Message | Tom Lane | 2011-01-14 17:14:21 | Re: tsearch (or related) question |