Re: functions returning records
Reinoud van Leeuwen <reinoud@xs4all.nl>
From: reinoud@xs4all.nl (Reinoud van Leeuwen)
To: pgsql-hackers@postgresql.org
Date: 2001-06-26T23:25:23Z
Lists: pgsql-hackers
On Tue, 26 Jun 2001 17:11:47 -0400 (EDT), you wrote: >I started thinking about Tom's idea to implement functions as table >source. > >To me, it seems that a very few changes are necessary: >a) parser must be changed to allow functioncall to be a table_ref >(easy) > >b) when a Query node is generated out of such a call "select * from foo()" >it should be almost identical to one generated out of "select * from >(select * from foo)" with one distinction: list of query attributes should >be completed based on return type of foo(). > >c) executor should support execution of such Query node, properly >extracting things out of function's return value and placing them into >result attributes. Coming from a Sybase environment I would love to have functions return a result set. A few things to think of: 1: will it be possible to return multiple result sets? (in Sybase any select statement that is not redirected to variables or a table goes to the client, so it is quite common to do multiple selects). Does the postgresql client library support this? 2: will it be possible to put a single result set in a table. Something like "resultfunction (argument) INTO TABLENAME" or "INSERT INTO TABLENAME resultfunction(argument) -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud@xs4all.nl http://www.xs4all.nl/~reinoud __________________________________________________