Skip to content

Commit 375e7d5

Browse files
committed
Use a safer order of operations in dropdb(): rollbackable operations,
ie removing shared-dependency entries, should happen before non-rollbackable ones. That way a failure during the rollbackable part doesn't leave us with inconsistent state.
1 parent 15a110e commit 375e7d5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/commands/dbcommands.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.171 2005/08/22 17:38:20 tgl Exp $
18+
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.172 2005/10/10 20:02:20 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -646,6 +646,11 @@ dropdb(const char *dbname)
646646
*/
647647
DeleteComments(db_id, DatabaseRelationId, 0);
648648

649+
/*
650+
* Remove shared dependency references for the database.
651+
*/
652+
dropDatabaseDependencies(db_id);
653+
649654
/*
650655
* Drop pages for this database that are in the shared buffer cache.
651656
* This is important to ensure that no remaining backend tries to
@@ -674,11 +679,6 @@ dropdb(const char *dbname)
674679
/* Close pg_database, but keep exclusive lock till commit */
675680
heap_close(pgdbrel, NoLock);
676681

677-
/*
678-
* Remove shared dependency references for the database.
679-
*/
680-
dropDatabaseDependencies(db_id);
681-
682682
/*
683683
* Set flag to update flat database file at commit.
684684
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy