Thread: 7.2 functions that return multiple result sets?
Can some one please confirm( with a plpgsql function example please ) a postgres "7.2" function that can return multiple rows to the client.
I've gone through the docs and can't find anything to support this -it seems you can only have one return value or null.
Yes i'm aware this it is possible in 7.3 - can someone please confirm its not possible in 7.2 or provide me with an example of how to go about it.
Thank you.
Found this using google
Depending on what you're doing (and if you're willing to work with the
7.2rcs or wait for it), 7.2 allows you to define functions that return
cursors that you can then fetch from within the transaction you called the
function in, so you should be able to do a sequence like:
begin;
select * from func(param);
-- get back name of cursor, say "<unnamed cursor 1>" --
fetch 10 from "<unnamed cursor 1>";
fetch 10 from "<unnamed cursor 1>";
close "<unnamed cursor 1>";
commit;
Seems 7.2 is limited to cursors, where 7.3 will do recordsets (and upgrading is SO easy)
7.2rcs or wait for it), 7.2 allows you to define functions that return
cursors that you can then fetch from within the transaction you called the
function in, so you should be able to do a sequence like:
begin;
select * from func(param);
-- get back name of cursor, say "<unnamed cursor 1>" --
fetch 10 from "<unnamed cursor 1>";
fetch 10 from "<unnamed cursor 1>";
close "<unnamed cursor 1>";
commit;
Seems 7.2 is limited to cursors, where 7.3 will do recordsets (and upgrading is SO easy)
HTH
Chad
----- Original Message -----From: mail.luckydigital.comSent: Sunday, February 02, 2003 2:45 PMSubject: [SQL] 7.2 functions that return multiple result sets?Can some one please confirm( with a plpgsql function example please ) a postgres "7.2" function that can return multiple rows to the client.I've gone through the docs and can't find anything to support this -it seems you can only have one return value or null.Yes i'm aware this it is possible in 7.3 - can someone please confirm its not possible in 7.2 or provide me with an example of how to go about it.Thank you.
On Sunday 02 February 2003 22:45, mail.luckydigital.com wrote: > Can some one please confirm( with a plpgsql function example please ) a > postgres "7.2" function that can return multiple rows to the client. > > I've gone through the docs and can't find anything to support this -it > seems you can only have one return value or null. > > Yes i'm aware this it is possible in 7.3 - can someone please confirm its > not possible in 7.2 or provide me with an example of how to go about it. IIRC this is a new feature in 7.3, see: http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=release.html "Allow functions to return multiple rows (table functions) (Joe)" Ian Barwick barwick@gmx.net