aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeLockRows.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeLockRows.c')
-rw-r--r--src/backend/executor/nodeLockRows.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/backend/executor/nodeLockRows.c b/src/backend/executor/nodeLockRows.c
index 990240bf0a8..5dcb9b042ac 100644
--- a/src/backend/executor/nodeLockRows.c
+++ b/src/backend/executor/nodeLockRows.c
@@ -194,7 +194,29 @@ lnext:
*/
if (!epq_started)
{
+ ListCell *lc2;
+
EvalPlanQualBegin(&node->lr_epqstate, estate);
+
+ /*
+ * Ensure that rels with already-visited rowmarks are told
+ * not to return tuples during the first EPQ test. We can
+ * exit this loop once it reaches the current rowmark;
+ * rels appearing later in the list will be set up
+ * correctly by the EvalPlanQualSetTuple call at the top
+ * of the loop.
+ */
+ foreach(lc2, node->lr_arowMarks)
+ {
+ ExecAuxRowMark *aerm2 = (ExecAuxRowMark *) lfirst(lc2);
+
+ if (lc2 == lc)
+ break;
+ EvalPlanQualSetTuple(&node->lr_epqstate,
+ aerm2->rowmark->rti,
+ NULL);
+ }
+
epq_started = true;
}