Commit a3cac3a0 authored by Tom Lane's avatar Tom Lane

Need to do BufferSync at end of DROP DATABASE as well as CREATE DATABASE.

Otherwise, newly connecting backends will still think the deleted DB is
valid, and will generate unexpected error messages.
parent c0f06994
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.70 2000/11/30 08:46:22 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.71 2001/01/14 22:14:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -153,7 +153,8 @@ createdb(const char *dbname, const char *dbpath,
elog(ERROR, "database path may not contain single quotes");
/* ... otherwise we'd be open to shell exploits below */
/* Force dirty buffers out to disk, to ensure source database is
/*
* Force dirty buffers out to disk, to ensure source database is
* up-to-date for the copy. (We really only need to flush buffers
* for the source database...)
*/
......@@ -253,7 +254,8 @@ createdb(const char *dbname, const char *dbpath,
/* Close pg_database, but keep lock till commit */
heap_close(pg_database_rel, NoLock);
/* Force dirty buffers out to disk, so that newly-connecting backends
/*
* Force dirty buffers out to disk, so that newly-connecting backends
* will see the new database in pg_database right away. (They'll see
* an uncommitted tuple, but they don't care; see GetRawDatabaseInfo.)
*/
......@@ -369,6 +371,14 @@ dropdb(const char *dbname)
* Remove the database's subdirectory and everything in it.
*/
remove_dbdirs(nominal_loc, alt_loc);
/*
* Force dirty buffers out to disk, so that newly-connecting backends
* will see the database tuple marked dead in pg_database right away.
* (They'll see an uncommitted deletion, but they don't care; see
* GetRawDatabaseInfo.)
*/
BufferSync();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment