Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21946ac

Browse files
committed
Fix corner case where SELECT FOR UPDATE could return a row twice.
In READ COMMITTED mode, if a SELECT FOR UPDATE discovers it has to redoWHERE-clause checking on rows that have been updated since the SELECT'ssnapshot, it invokes EvalPlanQual processing to do that. If this firstoccurs within a non-first child table of an inheritance tree, the previouscoding could accidentally re-return a matching row from an earlier,already-scanned child table. (And, to add insult to injury, I think thiscould make it miss returning a row that should have been returned, if theupdated row that this happens on should still have passed the WHERE qual.)Per report from Kyotaro Horiguchi; the added isolation test is based on histest case.This has been broken for quite awhile, so back-patch to all supportedbranches.
1 parent7292027 commit21946ac

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎src/backend/executor/nodeLockRows.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,29 @@ ExecLockRows(LockRowsState *node)
160160
*/
161161
if (!epq_started)
162162
{
163+
ListCell*lc2;
164+
163165
EvalPlanQualBegin(&node->lr_epqstate,estate);
166+
167+
/*
168+
* Ensure that rels with already-visited rowmarks are told
169+
* not to return tuples during the first EPQ test. We can
170+
* exit this loop once it reaches the current rowmark;
171+
* rels appearing later in the list will be set up
172+
* correctly by the EvalPlanQualSetTuple call at the top
173+
* of the loop.
174+
*/
175+
foreach(lc2,node->lr_arowMarks)
176+
{
177+
ExecAuxRowMark*aerm2= (ExecAuxRowMark*)lfirst(lc2);
178+
179+
if (lc2==lc)
180+
break;
181+
EvalPlanQualSetTuple(&node->lr_epqstate,
182+
aerm2->rowmark->rti,
183+
NULL);
184+
}
185+
164186
epq_started= true;
165187
}
166188

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp