aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/dbcommands.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-10-10 20:02:20 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-10-10 20:02:20 +0000
commit375e7d557974d43e0c059c8894ac976e90333013 (patch)
tree0bc99f179edf4c6f46638a3fe3211d9a1af3ccb4 /src/backend/commands/dbcommands.c
parent15a110ed01d448e07ad4689c5b7809bb9c526dcd (diff)
downloadpostgresql-375e7d557974d43e0c059c8894ac976e90333013.tar.gz
postgresql-375e7d557974d43e0c059c8894ac976e90333013.zip
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.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r--src/backend/commands/dbcommands.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 49d3e1d4f5d..548648066b8 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.171 2005/08/22 17:38:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.172 2005/10/10 20:02:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -647,6 +647,11 @@ dropdb(const char *dbname)
DeleteComments(db_id, DatabaseRelationId, 0);
/*
+ * Remove shared dependency references for the database.
+ */
+ dropDatabaseDependencies(db_id);
+
+ /*
* Drop pages for this database that are in the shared buffer cache.
* This is important to ensure that no remaining backend tries to
* write out a dirty buffer to the dead database later...
@@ -675,11 +680,6 @@ dropdb(const char *dbname)
heap_close(pgdbrel, NoLock);
/*
- * Remove shared dependency references for the database.
- */
- dropDatabaseDependencies(db_id);
-
- /*
* Set flag to update flat database file at commit.
*/
database_file_update_needed();