]> granicus.if.org Git - postgresql/commit
Fix corner case where SELECT FOR UPDATE could return a row twice.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 12 Dec 2014 00:37:00 +0000 (19:37 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 12 Dec 2014 00:37:36 +0000 (19:37 -0500)
commit2db576ba8c449fcaf61ae7aa14ed62e63ebf5924
treeb52d0c09ff79a8852ae6c0280c68cb9a6b80cab3
parent2646d2d4a9d8b978fda0d0d1affae4788a30f604
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 redo
WHERE-clause checking on rows that have been updated since the SELECT's
snapshot, it invokes EvalPlanQual processing to do that.  If this first
occurs within a non-first child table of an inheritance tree, the previous
coding could accidentally re-return a matching row from an earlier,
already-scanned child table.  (And, to add insult to injury, I think this
could make it miss returning a row that should have been returned, if the
updated row that this happens on should still have passed the WHERE qual.)
Per report from Kyotaro Horiguchi; the added isolation test is based on his
test case.

This has been broken for quite awhile, so back-patch to all supported
branches.
src/backend/executor/nodeLockRows.c
src/test/isolation/expected/eval-plan-qual.out
src/test/isolation/specs/eval-plan-qual.spec