Skip site navigation (1) Skip section navigation (2)

Re: Returning multiple cursors from PL/PgSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Returning multiple cursors from PL/PgSQL
Date: 2005-01-13 18:44:58
Message-ID: 12369.1105641898@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
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

In response to

Responses

pgsql-patches by date

Next:From: Peter EisentrautDate: 2005-01-13 19:05:35
Subject: Re: Translation updates
Previous:From: D'Arcy J.M. CainDate: 2005-01-13 18:22:42
Subject: Re: Much Ado About COUNT(*)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group