Re: cursor sensitivity misunderstanding
От | David G. Johnston |
---|---|
Тема | Re: cursor sensitivity misunderstanding |
Дата | |
Msg-id | CAKFQuwaHBW3m6-=zC-FuNa4cWcDREdCE9pNonONDkFE0ydhtyQ@mail.gmail.com обсуждение исходный текст |
Ответ на | cursor sensitivity misunderstanding (Peter Eisentraut <peter.eisentraut@enterprisedb.com>) |
Ответы |
Re: cursor sensitivity misunderstanding
|
Список | 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;
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 по дате отправления: