Re: committing inside cursor loop - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: committing inside cursor loop
Date
Msg-id 923b0dc9-31c2-15aa-7820-3e9aa17ac861@2ndquadrant.com
Whole thread Raw
In response to Re: committing inside cursor loop  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: committing inside cursor loop  (Ildus Kurbangaliev <i.kurbangaliev@gmail.com>)
List pgsql-hackers
On 3/19/18 20:40, Peter Eisentraut wrote:
> On 3/14/18 08:05, Ildus Kurbangaliev wrote:
>>> The ROLLBACK call in the first loop iteration undoes the UPDATE
>>> command that drives the loop.  Is it then sensible to continue the
>>> loop?
>>>
>> I think that in the first place ROLLBACK was prohibited because of cases
>> like this, but it seems to safe to continue the loop when portal
>> strategy is PORTAL_ONE_SELECT.
> 
> Maybe, but even plain SELECT commands can have side effects.

Here is an updated patch that supports the ROLLBACK case as well, and
prevents holding portals with a strategy other than PORTAL_ONE_SELECT.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Why does load_external_function() return PGFunction?
Next
From: Pavel Stehule
Date:
Subject: Re: Re: csv format for psql