Commit 233ecca7 authored by Tom Lane's avatar Tom Lane

Further thinking about heap_mark4update: in HeapTupleSelfUpdated case,

executor should not return the tuple as successfully marked, because in
fact it's been deleted.  Not clear that this case has ever been seen
in practice (I think you'd have to write a SELECT FOR UPDATE that calls
a function that deletes some row the SELECT will visit later...) but we
should be consistent.  Also add comments to several other places that
got it right but didn't explain what they were doing.
parent 0d3be98a
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.132 2002/09/21 18:39:25 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.133 2002/09/23 22:57:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1209,6 +1209,7 @@ ltrmark:; ...@@ -1209,6 +1209,7 @@ ltrmark:;
switch (test) switch (test)
{ {
case HeapTupleSelfUpdated: case HeapTupleSelfUpdated:
/* treat it as deleted; do not process */
ReleaseBuffer(buffer); ReleaseBuffer(buffer);
return (NULL); return (NULL);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.178 2002/09/04 20:31:17 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.179 2002/09/23 22:57:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1032,6 +1032,9 @@ lnext: ; ...@@ -1032,6 +1032,9 @@ lnext: ;
switch (test) switch (test)
{ {
case HeapTupleSelfUpdated: case HeapTupleSelfUpdated:
/* treat it as deleted; do not process */
goto lnext;
case HeapTupleMayBeUpdated: case HeapTupleMayBeUpdated:
break; break;
...@@ -1303,6 +1306,7 @@ ldelete:; ...@@ -1303,6 +1306,7 @@ ldelete:;
switch (result) switch (result)
{ {
case HeapTupleSelfUpdated: case HeapTupleSelfUpdated:
/* already deleted by self; nothing to do */
return; return;
case HeapTupleMayBeUpdated: case HeapTupleMayBeUpdated:
...@@ -1437,6 +1441,7 @@ lreplace:; ...@@ -1437,6 +1441,7 @@ lreplace:;
switch (result) switch (result)
{ {
case HeapTupleSelfUpdated: case HeapTupleSelfUpdated:
/* already deleted by self; nothing to do */
return; return;
case HeapTupleMayBeUpdated: case HeapTupleMayBeUpdated:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment