Re: cursor sensitivity misunderstanding

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: cursor sensitivity misunderstanding
Date: 2021-02-18 16:11:27
Message-ID: CAKFQuwaHBW3m6-=zC-FuNa4cWcDREdCE9pNonONDkFE0ydhtyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 18, 2021 at 9:00 AM Peter Eisentraut <
peter(dot)eisentraut(at)enterprisedb(dot)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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2021-02-18 16:12:57 Re: [Proposal] Page Compression for OLTP
Previous Message Jan Wieck 2021-02-18 16:01:38 Re: Extensibility of the PostgreSQL wire protocol