mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
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.
This commit is contained in:
@ -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 ***/
|
||||
|
||||
|
Reference in New Issue
Block a user