Fix EvalPlanQual rechecking during MERGE.
Dean Rasheed <dean.a.rasheed@gmail.com>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/nodeModifyTable.c | modified | +3 −3 |
| src/backend/executor/README | modified | +6 −6 |
| src/backend/optimizer/plan/planner.c | modified | +3 −2 |
| src/include/nodes/execnodes.h | modified | +2 −2 |
| src/include/nodes/plannodes.h | modified | +2 −2 |
| src/test/isolation/expected/merge-join.out | added | +148 −0 |
| src/test/isolation/isolation_schedule | modified | +1 −0 |
| src/test/isolation/specs/merge-join.spec | added | +45 −0 |
| src/test/regress/expected/merge.out | modified | +4 −4 |
| src/test/regress/expected/with.out | modified | +23 −19 |
Discussion
- BUG #18103: bugs of concurrent merge into when use different join plan 6 messages · 2023-09-10 → 2023-09-27