On Wed, Jan 11, 2006 at 04:11:18PM +0200, Peter Filipov wrote:
> Is the idea to use cursors as table sources good?
> Do you plan to implement it in the future and if you plan will it be soon?
Do you mean the ability to use a cursor as one of the sources in
the FROM clause? Something like the following non-working examples?
DECLARE curs CURSOR FOR SELECT * FROM table1;
SELECT * FROM table2, curs;
or
DECLARE curs CURSOR FOR SELECT * FROM table1;
SELECT * FROM table2, (FETCH ALL FROM curs) AS s;
As far as I know PostgreSQL doesn't allow anything like that;
somebody please correct me if I'm mistaken. However, you could
write a set-returning function that takes a refcursor argument and
iterates through the cursor, returning each row, and use that
function in the FROM clause. Whether that's a good idea or not is
something I haven't given much thought to. Is there a reason you'd
want to use a cursor instead of, say, a view?
Are you just curious or is there a problem you're trying to solve?
If I've misunderstood what you're asking then please elaborate.
--
Michael Fuhr