Re: Record with a field consisting of table rows - Mailing list pgsql-general

From Jon Smark
Subject Re: Record with a field consisting of table rows
Date
Msg-id 942767.46957.qm@web112815.mail.gq1.yahoo.com
Whole thread Raw
In response to Re: Record with a field consisting of table rows  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Record with a field consisting of table rows  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Record with a field consisting of table rows  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List 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





pgsql-general by date:

Previous
From: Satoshi Nagayasu
Date:
Subject: tsearch (or related) question
Next
From: Pavel Stehule
Date:
Subject: Re: Record with a field consisting of table rows