Re: cursor sensitivity misunderstanding - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: cursor sensitivity misunderstanding
Date
Msg-id CAKFQuwaHBW3m6-=zC-FuNa4cWcDREdCE9pNonONDkFE0ydhtyQ@mail.gmail.com
Whole thread Raw
In response to cursor sensitivity misunderstanding  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: cursor sensitivity misunderstanding
List pgsql-hackers
On Thu, Feb 18, 2021 at 9:00 AM Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:

And that seems definitely wrong.  Declaring c1 in the above example as
FOR UPDATE or FOR SHARE does not change the result.  I think this
discussion is mixing up the concept of cursor sensitivity with
transaction isolation.

Thoughts?


This came up on Discord in the context of pl/pgsql last month - never really came to a conclusion.

"
open curs FOR SELECT * FROM Res FOR UPDATE;
    LOOP
        FETCH curs into record;
        EXIT WHEN NOT FOUND;
        INSERT INTO Res SELECT Type.Name
                        FROM Type
                        WHERE Type.SupClass = record.Name;
    END LOOP;
"

The posted question was: "this doesn't go over rows added during the loop despite the FOR UPDATE"

The OP was doing a course based on Oracle and was confused regarding our behavior.  The documentation failed to help me provide a useful response, so I'd agree there is something here that needs reworking if not outright fixing.

David J.

pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Extensibility of the PostgreSQL wire protocol
Next
From: David Fetter
Date:
Subject: Re: [Proposal] Page Compression for OLTP