Re: Returning a set from an function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Keith Hutchison" <keith(dot)kjtl(dot)hutchison(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Returning a set from an function
Date: 2006-04-08 21:46:26
Message-ID: 28752.1144532786@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Keith Hutchison" <keith(dot)kjtl(dot)hutchison(at)gmail(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2006-04-10 01:14:07 Re: Modeling trees with Nested Sets and Nested Intervals
Previous Message Keith Hutchison 2006-04-08 21:10:38 Returning a set from an function