Re: DECLARE CURSOR must not contain data-modifying statements in WITH - Mailing list pgsql-hackers

From Robert Haas
Subject Re: DECLARE CURSOR must not contain data-modifying statements in WITH
Date
Msg-id CA+TgmobCKwc=bDfP64n91e1KKkM2OkcON61RuV-gWgK2x5mFxQ@mail.gmail.com
Whole thread Raw
In response to Re: DECLARE CURSOR must not contain data-modifying statements in WITH  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Fri, Sep 23, 2011 at 10:53 AM, Andres Freund <andres@anarazel.de> wrote:
> One could argue that its a easier to implement it using a wCTE because the
> query will be simply materialize the query upfront.
> That makes handling the case where somebody fetches 3 tuples from a query
> updating 10 easier.
>
> Thats a bit harder for the normal cursor case because there is no tuplestore
> around to do that (except the WITH HOLD case where that is only used on
> commit...).
>
> I find it an acceptable way to enforce using a CTE to do cursors on DML because
> it makes it more clear that they will be fully executed on start...

Hmm, maybe.  But if that's true, why does the comment read the way it
does?  If the updates all occur at the beginning, that wouldn't be
"surprising", would it?

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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [pgsql-advocacy] Unlogged vs. In-Memory
Next
From: Greg Stark
Date:
Subject: Re: memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs)