Re: Record with a field consisting of table rows

From: Jon Smark <jon(dot)smark(at)yahoo(dot)com>
To: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: 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 15:03:19
Message-ID: 942767.46957.qm@web112815.mail.gq1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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:

CREATE TYPE page_t AS
(
total int4
users SETOF users
)

Which is of course not grammatical. So, how does one solve this problem
in PL/pgSQL?

Thanks in advance!
Jon

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ing. Yunior Mesa Reyes 2011-01-14 15:36:42 Oferta de un nuevo Entrenamiento en el marco del Tercer PGDay Latinoamericano.
Previous Message Satoshi Nagayasu 2011-01-14 14:38:18 tsearch (or related) question