Re: Returning multiple cursors from PL/PgSQL

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Returning multiple cursors from PL/PgSQL
Date: 2005-01-13 19:30:38
Message-ID: 20050113193038.GA9873@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Thu, Jan 13, 2005 at 01:44:58PM -0500, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)org> writes:
> >> Please find attached an example that allows people to return multiple
> >> named refcursors from a function. Big kudos to Kris Jurka for
> >> figuring this out and pasting to rafb :)
>
> > Oops. Joe Conway pointed out that this patch could be more succinct
> > and not create an essentially useless new type.
>
> I think the example is pretty confusing, or at least not compelling,
> since it's not clear to the reader why you'd go to all that trouble
> to return two scalars. The cursors ought to return rowsets.
> Maybe
>
> + OPEN $1 FOR SELECT * FROM table1;
> + RETURN NEXT $1;
> + OPEN $2 FOR SELECT * FROM table2;
> + RETURN NEXT $2;
>
> regards, tom lane

Good point. Next patch attached :)

Cheers,
D
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778

Remember to vote!

Attachment Content-Type Size
multiple_cursor.diff text/plain 1.0 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-01-14 01:17:47 Re: Another Plpgsql trigger example - summary table
Previous Message Jonah H. Harris 2005-01-13 19:20:36 Re: Much Ado About COUNT(*)