Re: More WITH

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: More WITH
Date: 2015-08-21 18:48:27
Message-ID: CA+TgmoYXOm5Rv9A8cRkOMWGB5rRTORgbHeQC-UpmOJ_=5X2r7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 21, 2015 at 2:39 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Tue, Aug 18, 2015 at 11:23 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> More generally, what would you hope to accomplish with such a construct
>>> that wouldn't be better done by writing the cursor's underlying query
>>> directly in the WITH clause?
>
>> Maybe I'm stupid today, but it seems like the obvious use case would
>> be fetching some but not all rows from the cursor?
>
> And how many rows would that be? As I said, the proposed syntax leaves
> it completely unclear how many rows get fetched or what the ending cursor
> position is; but especially so if you want the answer to be something
> other than "all/the end".

/me is bemused.

The existing syntax for FETCH already includes a way to specify the
number of rows you want to fetch, as in this example from the
documentation:

FETCH FORWARD 5 FROM liahona;

Why wouldn't that work here too?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-08-21 18:53:14 Re: More WITH
Previous Message Robert Haas 2015-08-21 18:45:22 Re: Reduce ProcArrayLock contention