Re: selecting large result sets in psql using cursors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, Chris Mair <list(at)1006(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: selecting large result sets in psql using cursors
Date: 2006-08-16 16:50:51
Message-ID: 26613.1155747051@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Chris Mair <list(at)1006(dot)org> writes:
> attached is the new and fixed version of the patch for selecting
> large result sets from psql using cursors.

The is_select_command bit is wrong because it doesn't allow for left
parentheses in front of the SELECT keyword (something entirely
reasonable when considering big union/intersect/except trees).
Also you'd need to allow for VALUES as the first keyword.
But isn't the whole thing unnecessary? ISTM you could just ship the
query with the DECLARE CURSOR prepended, and see whether you get a
syntax error or not.

At some point we ought to extend libpq enough to expose the V3-protocol
feature that allows partial fetches from portals; that would be a
cleaner way to implement this feature. However since nobody has yet
proposed a good API for this in libpq, I don't object to implementing
\u with DECLARE CURSOR for now.

BTW, \u seems not to have any mnemonic value whatsoever ... isn't there
some other name we could use?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-08-16 17:02:32 Re: BugTracker
Previous Message Andrew Dunstan 2006-08-16 16:36:24 timing psql internal commands

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2006-08-16 20:47:12 Re: [HACKERS] Forcing current WAL file to be archived
Previous Message Tom Lane 2006-08-16 15:45:53 Re: [HACKERS] Forcing current WAL file to be archived