summaryrefslogtreecommitdiff
path: root/src/backend/commands/dbcommands.c
diff options
context:
space:
mode:
authorAlvaro Herrera2007-01-16 13:28:57 +0000
committerAlvaro Herrera2007-01-16 13:28:57 +0000
commit2da2a01afb2f37ce13b63412d49db9ee99ab7674 (patch)
tree16ba1371993afc4faf42c9f496df0cb8aadd7439 /src/backend/commands/dbcommands.c
parent24667ddd18b679321c08bd8bbfbe30bd4d0e252c (diff)
Arrange for autovacuum to be killed when another operation wants to be alone
accessing it, like DROP DATABASE. This allows the regression tests to pass with autovacuum enabled, which open the gates for finally enabling autovacuum by default.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r--src/backend/commands/dbcommands.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index a19695bab1..eb025ee6de 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -250,11 +250,11 @@ createdb(const CreatedbStmt *stmt)
* (exception is to allow CREATE DB while connected to template1).
* Otherwise we might copy inconsistent data.
*/
- if (DatabaseHasActiveBackends(src_dboid, true))
+ if (DatabaseCancelAutovacuumActivity(src_dboid, true))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
- errmsg("source database \"%s\" is being accessed by other users",
- dbtemplate)));
+ errmsg("source database \"%s\" is being accessed by other users",
+ dbtemplate)));
/* If encoding is defaulted, use source's encoding */
if (encoding < 0)
@@ -602,7 +602,7 @@ dropdb(const char *dbname, bool missing_ok)
* Check for active backends in the target database. (Because we hold the
* database lock, no new ones can start after this.)
*/
- if (DatabaseHasActiveBackends(db_id, false))
+ if (DatabaseCancelAutovacuumActivity(db_id, false))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
errmsg("database \"%s\" is being accessed by other users",
@@ -706,7 +706,7 @@ RenameDatabase(const char *oldname, const char *newname)
* Make sure the database does not have active sessions. This is the same
* concern as above, but applied to other sessions.
*/
- if (DatabaseHasActiveBackends(db_id, false))
+ if (DatabaseCancelAutovacuumActivity(db_id, false))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
errmsg("database \"%s\" is being accessed by other users",