aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execCurrent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/execCurrent.c')
-rw-r--r--src/backend/executor/execCurrent.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c
index 7480cf50ad0..aadf7493827 100644
--- a/src/backend/executor/execCurrent.c
+++ b/src/backend/executor/execCurrent.c
@@ -91,21 +91,22 @@ execCurrentOf(CurrentOfExpr *cexpr,
* the other code can't, while the non-FOR-UPDATE case allows use of WHERE
* CURRENT OF with an insensitive cursor.
*/
- if (queryDesc->estate->es_rowMarks)
+ if (queryDesc->estate->es_rowmarks)
{
ExecRowMark *erm;
- ListCell *lc;
+ Index i;
/*
* Here, the query must have exactly one FOR UPDATE/SHARE reference to
* the target table, and we dig the ctid info out of that.
*/
erm = NULL;
- foreach(lc, queryDesc->estate->es_rowMarks)
+ for (i = 0; i < queryDesc->estate->es_range_table_size; i++)
{
- ExecRowMark *thiserm = (ExecRowMark *) lfirst(lc);
+ ExecRowMark *thiserm = queryDesc->estate->es_rowmarks[i];
- if (!RowMarkRequiresRowShareLock(thiserm->markType))
+ if (thiserm == NULL ||
+ !RowMarkRequiresRowShareLock(thiserm->markType))
continue; /* ignore non-FOR UPDATE/SHARE items */
if (thiserm->relid == table_oid)