Skip to content

Commit b3d8bea

Browse files
committed
Catch non-functional delete attempts.
1 parent 6ed1715 commit b3d8bea

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/backend/access/heap/heapam.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.11 1997/03/28 07:04:11 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.12 1997/08/06 02:08:39 vadim Exp $
1111
*
1212
*
1313
* INTERFACE ROUTINES
@@ -1150,6 +1150,19 @@ heap_delete(Relation relation, ItemPointer tid)
11501150
dp = (PageHeader) BufferGetPage(b);
11511151
lp = PageGetItemId(dp, ItemPointerGetOffsetNumber(tid));
11521152

1153+
/*
1154+
* Just like test against non-functional updates we try to catch
1155+
* non-functional delete attempts. - vadim 05/05/97
1156+
*/
1157+
tp = (HeapTuple) PageGetItem((Page)dp, lp);
1158+
Assert(HeapTupleIsValid(tp));
1159+
if (TupleUpdatedByCurXactAndCmd(tp)) {
1160+
elog(NOTICE, "Non-functional delete, tuple already deleted");
1161+
if ( IsSystemRelationName(RelationGetRelationName(relation)->data) )
1162+
RelationUnsetLockForWrite(relation);
1163+
ReleaseBuffer(b);
1164+
return;
1165+
}
11531166
/* ----------------
11541167
* check that we're deleteing a valid item
11551168
* ----------------

0 commit comments

Comments
 (0)