mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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.
This commit is contained in:
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -646,6 +646,11 @@ dropdb(const char *dbname)
|
|||||||
*/
|
*/
|
||||||
DeleteComments(db_id, DatabaseRelationId, 0);
|
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.
|
* Drop pages for this database that are in the shared buffer cache.
|
||||||
* This is important to ensure that no remaining backend tries to
|
* This is important to ensure that no remaining backend tries to
|
||||||
@ -674,11 +679,6 @@ dropdb(const char *dbname)
|
|||||||
/* Close pg_database, but keep exclusive lock till commit */
|
/* Close pg_database, but keep exclusive lock till commit */
|
||||||
heap_close(pgdbrel, NoLock);
|
heap_close(pgdbrel, NoLock);
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove shared dependency references for the database.
|
|
||||||
*/
|
|
||||||
dropDatabaseDependencies(db_id);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set flag to update flat database file at commit.
|
* Set flag to update flat database file at commit.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user