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.
This commit is contained in:
Tom Lane 2002-09-23 22:57:44 +00:00
parent 0d3be98ae9
commit 233ecca7c9
2 changed files with 8 additions and 2 deletions

View File

@ -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:;
switch (test) switch (test)
{ {
case HeapTupleSelfUpdated: case HeapTupleSelfUpdated:
/* treat it as deleted; do not process */
ReleaseBuffer(buffer); ReleaseBuffer(buffer);
return (NULL); return (NULL);

View File

@ -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: ;
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:;
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:;
switch (result) switch (result)
{ {
case HeapTupleSelfUpdated: case HeapTupleSelfUpdated:
/* already deleted by self; nothing to do */
return; return;
case HeapTupleMayBeUpdated: case HeapTupleMayBeUpdated: