Search Postgresql Archives

Re: cursors as table sources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux