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/comment.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/comment.c')
-rw-r--r-- | src/backend/commands/comment.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c index 1af4ba102f7..46e8b8057ec 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -6,6 +6,9 @@ * * Copyright (c) 1999, PostgreSQL Global Development Group * + * IDENTIFICATION + * $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.26 2001/01/23 04:32:21 tgl Exp $ + * *------------------------------------------------------------------------- */ @@ -169,15 +172,15 @@ CreateComments(Oid oid, char *comment) if (HeapTupleIsValid(searchtuple)) { - /*** If the comment is blank, call heap_delete, else heap_update ***/ + /*** If the comment is blank, delete old entry, else update it ***/ if ((comment == NULL) || (strlen(comment) == 0)) - heap_delete(description, &searchtuple->t_self, NULL); + simple_heap_delete(description, &searchtuple->t_self); else { desctuple = heap_modifytuple(searchtuple, description, values, nulls, replaces); - heap_update(description, &searchtuple->t_self, desctuple, NULL); + simple_heap_update(description, &searchtuple->t_self, desctuple); modified = TRUE; } @@ -253,7 +256,7 @@ DeleteComments(Oid oid) /*** If a previous tuple exists, delete it ***/ if (HeapTupleIsValid(searchtuple)) - heap_delete(description, &searchtuple->t_self, NULL); + simple_heap_delete(description, &searchtuple->t_self); /*** Complete the scan, update indices, if necessary ***/ @@ -395,7 +398,7 @@ CommentDatabase(char *database, char *comment) Oid oid; bool superuser; int32 dba; - Oid userid; + Oid userid; /*** First find the tuple in pg_database for the database ***/ |