Re: cursor sensitivity misunderstanding
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-02-18T16:11:27Z
Lists: 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.
Commits
-
Fix use of cursor sensitivity terminology
- dd13ad9d39a1 14.0 landed