Re: SETOF and language 'plpgsql'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Eric Ridge" <ebr(at)tcdi(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SETOF and language 'plpgsql'
Date: 2001-11-03 21:42:41
Message-ID: 3083.1004823761@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Eric Ridge" <ebr(at)tcdi(dot)com> writes:
>> How do you return a "setof <datatype>" from a plpgsql function?

> After searching the archives I found a post by Jan Wieck that basically
> says, "You can't....not sure if we will be able to do it for 7.2".
> Then Tom Lane replied, "...If you want to fix plpgsql so that it retains
> state and can produce multiple elements of a set over repeated calls,
> the same way that SQL functions do, then it could be done today."

I think you misread that ;-). What I was saying was that there wasn't
(any longer) anything outside plpgsql that would prevent it from
returning sets. There would be a nontrivial amount of work to do inside
plpgsql to make it happen; see Jan's followup
http://archives2.us.postgresql.org/pgsql-sql/2000-08/msg00258.php

> It's over a year later. What's the status today?

About the same.

There is support in 7.2 for plpgsql functions to return references to
cursors. This is not by any means the same thing as a SETOF result,
but it can serve some of the same purposes.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2001-11-03 21:53:52 Re: Off-Topic: Accounting question
Previous Message Eric Ridge 2001-11-03 21:08:43 Re: SETOF and language 'plpgsql'