]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix EvalPlanQual rechecking during MERGE.
authorDean Rasheed <dean.a.rasheed@gmail.com>
Sat, 30 Sep 2023 09:55:24 +0000 (10:55 +0100)
committerDean Rasheed <dean.a.rasheed@gmail.com>
Sat, 30 Sep 2023 09:55:24 +0000 (10:55 +0100)
commit3c1a1af91d9504e4ce0319f48e83f7c2d5765969
tree006c870d4a63fcf8dccbdacdb16e5b733cba7af1
parentef595bf74459aac3d944714719bd33b87fbc0df1
Fix EvalPlanQual rechecking during MERGE.

Under some circumstances, concurrent MERGE operations could lead to
inconsistent results, that varied according the plan chosen. This was
caused by a lack of rowmarks on the source relation, which meant that
EvalPlanQual rechecking was not guaranteed to return the same source
tuples when re-running the join query.

Fix by ensuring that preprocess_rowmarks() sets up PlanRowMarks for
all non-target relations used in MERGE, in the same way that it does
for UPDATE and DELETE.

Per bug #18103. Back-patch to v15, where MERGE was introduced.

Dean Rasheed, reviewed by Richard Guo.

Discussion: https://postgr.es/m/18103-c4386baab8e355e3%40postgresql.org
src/backend/executor/README
src/backend/executor/nodeModifyTable.c
src/backend/optimizer/plan/planner.c
src/include/nodes/execnodes.h
src/include/nodes/plannodes.h
src/test/isolation/expected/merge-join.out [new file with mode: 0644]
src/test/isolation/isolation_schedule
src/test/isolation/specs/merge-join.spec [new file with mode: 0644]
src/test/regress/expected/merge.out
src/test/regress/expected/with.out