]> granicus.if.org Git - postgresql/commitdiff
Further thinking about heap_mark4update: in HeapTupleSelfUpdated case,
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 23 Sep 2002 22:57:44 +0000 (22:57 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 23 Sep 2002 22:57:44 +0000 (22:57 +0000)
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.

src/backend/commands/trigger.c
src/backend/executor/execMain.c

index eb78fe484a35ea82ba1bef0f8e8a1555621de22a..fcc16c4342c0f2402c75e8612bb7dbc25ace265a 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * 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)
                {
                        case HeapTupleSelfUpdated:
+                               /* treat it as deleted; do not process */
                                ReleaseBuffer(buffer);
                                return (NULL);
 
index 300c415a015ba7f37a9d1f136a4ac70227bb8231..370d7e52ec36b434348300cc9f4f2530c80f3206 100644 (file)
@@ -27,7 +27,7 @@
  *
  *
  * 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)
                                        {
                                                case HeapTupleSelfUpdated:
+                                                       /* treat it as deleted; do not process */
+                                                       goto lnext;
+
                                                case HeapTupleMayBeUpdated:
                                                        break;
 
@@ -1303,6 +1306,7 @@ ldelete:;
        switch (result)
        {
                case HeapTupleSelfUpdated:
+                       /* already deleted by self; nothing to do */
                        return;
 
                case HeapTupleMayBeUpdated:
@@ -1437,6 +1441,7 @@ lreplace:;
        switch (result)
        {
                case HeapTupleSelfUpdated:
+                       /* already deleted by self; nothing to do */
                        return;
 
                case HeapTupleMayBeUpdated: