diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-23 04:32:23 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-23 04:32:23 +0000 |
commit | 786f1a59cd44f890b2423e15ba3ab172dab968bf (patch) | |
tree | 30a730a13a351ac02264f7f48ab6145eb7c51e17 /src/backend/commands/async.c | |
parent | 7a2a1acd520761b479c9dfc4a8e573aeec626094 (diff) | |
download | postgresql-786f1a59cd44f890b2423e15ba3ab172dab968bf.tar.gz postgresql-786f1a59cd44f890b2423e15ba3ab172dab968bf.zip |
Fix all the places that called heap_update() and heap_delete() without
bothering to check the return value --- which meant that in case the
update or delete failed because of a concurrent update, you'd not find
out about it, except by observing later that the transaction produced
the wrong outcome. There are now subroutines simple_heap_update and
simple_heap_delete that should be used anyplace that you're not prepared
to do the full nine yards of coping with concurrent updates. In
practice, that seems to mean absolutely everywhere but the executor,
because *noplace* else was checking.
Diffstat (limited to 'src/backend/commands/async.c')
-rw-r--r-- | src/backend/commands/async.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index b86f2421eb8..a2bcbb5b663 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.74 2000/12/18 17:33:40 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.75 2001/01/23 04:32:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -299,7 +299,7 @@ Async_Unlisten(char *relname, int pid) 0, 0); if (HeapTupleIsValid(lTuple)) { - heap_delete(lRel, &lTuple->t_self, NULL); + simple_heap_delete(lRel, &lTuple->t_self); ReleaseSysCache(lTuple); } heap_close(lRel, AccessExclusiveLock); @@ -349,7 +349,9 @@ Async_UnlistenAll() sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key); while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0))) - heap_delete(lRel, &lTuple->t_self, NULL); + { + simple_heap_delete(lRel, &lTuple->t_self); + } heap_endscan(sRel); heap_close(lRel, AccessExclusiveLock); @@ -506,7 +508,7 @@ AtCommit_Notify() * just do it for any failure (certainly at least for * EPERM too...) */ - heap_delete(lRel, &lTuple->t_self, NULL); + simple_heap_delete(lRel, &lTuple->t_self); } else { @@ -516,7 +518,7 @@ AtCommit_Notify() { rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl); - heap_update(lRel, &lTuple->t_self, rTuple, NULL); + simple_heap_update(lRel, &lTuple->t_self, rTuple); if (RelationGetForm(lRel)->relhasindex) { Relation idescs[Num_pg_listener_indices]; @@ -797,7 +799,7 @@ ProcessIncomingNotify(void) NotifyMyFrontEnd(relname, sourcePID); /* Rewrite the tuple with 0 in notification column */ rTuple = heap_modifytuple(lTuple, lRel, value, nulls, repl); - heap_update(lRel, &lTuple->t_self, rTuple, NULL); + simple_heap_update(lRel, &lTuple->t_self, rTuple); if (RelationGetForm(lRel)->relhasindex) { Relation idescs[Num_pg_listener_indices]; |