From: Tom Lane <tgl@sss.pgh.pa.us>
To: Keith Hutchison <keith.kjtl.hutchison@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Returning a set from an function
Date: Sat, 08 Apr 2006 17:46:26 -0400
Message-ID: <28752.1144532786@sss.pgh.pa.us> (raw)
In-Reply-To: <45435c1a0604081410o12d5a456x1fb6d09ce8973cc6@mail.gmail.com>
References: <45435c1a0604081410o12d5a456x1fb6d09ce8973cc6@mail.gmail.com>
"Keith Hutchison" <keith.kjtl.hutchison@gmail.com> writes:
> Looking for an example showing how to return a set from either a sql
> function or a plpsqq function.
Try "SQL Functions Returning Sets" here:
http://www.postgresql.org/docs/8.1/static/xfunc-sql.html
In plpgsql you just "RETURN NEXT" each value (typically this would
be inside a loop, though it doesn't have to be) and then either
RETURN with no argument or fall off the end of the function (I think
the latter is only allowed as of PG 8.1). There don't seem to be
any very compelling examples in the manual, but I bet you can find
some at techdocs.postgresql.org.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, keith.kjtl.hutchison@gmail.com
Subject: Re: Returning a set from an function
In-Reply-To: <28752.1144532786@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox