diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-16 17:34:28 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-11-16 17:34:28 +0000 |
commit | 18004101acb98d8fefe7dda1c9f010cceff83b6d (patch) | |
tree | 2c9436b642ca63f2b831ba4e3cfd16d34436e6a2 /src/backend/executor/execMain.c | |
parent | 30f272a79b248fea1f25d63a3648d2660d370a69 (diff) | |
download | postgresql-18004101acb98d8fefe7dda1c9f010cceff83b6d.tar.gz postgresql-18004101acb98d8fefe7dda1c9f010cceff83b6d.zip |
Modify UPDATE/DELETE WHERE CURRENT OF to use the FOR UPDATE infrastructure to
locate the target row, if the cursor was declared with FOR UPDATE or FOR
SHARE. This approach is more flexible and reliable than digging through the
plan tree; for instance it can cope with join cursors. But we still provide
the old code for use with non-FOR-UPDATE cursors. Per gripe from Robert Haas.
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 634ca69b4d1..6d389319fcc 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -26,7 +26,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.316 2008/11/15 19:43:45 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.317 2008/11/16 17:34:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -609,6 +609,7 @@ InitPlan(QueryDesc *queryDesc, int eflags) /* We'll locate the junk attrs below */ erm->ctidAttNo = InvalidAttrNumber; erm->toidAttNo = InvalidAttrNumber; + ItemPointerSetInvalid(&(erm->curCtid)); estate->es_rowMarks = lappend(estate->es_rowMarks, erm); } @@ -1418,6 +1419,7 @@ lnext: ; if (tableoid != RelationGetRelid(erm->relation)) { /* this child is inactive right now */ + ItemPointerSetInvalid(&(erm->curCtid)); continue; } } @@ -1481,6 +1483,9 @@ lnext: ; elog(ERROR, "unrecognized heap_lock_tuple status: %u", test); } + + /* Remember tuple TID for WHERE CURRENT OF */ + erm->curCtid = tuple.t_self; } } |