pg_autovacuum causes 'create database' to fail when the first is accessing 'template1' - Mailing list pgsql-general

From Frank van Vugt
Subject pg_autovacuum causes 'create database' to fail when the first is accessing 'template1'
Date
Msg-id 200311081108.58574.ftm.van.vugt@foxi.nl
Whole thread Raw
Responses Re: pg_autovacuum causes 'create database' to fail when the
List pgsql-general
Hi,

I noticed that when using the single commandline:

drop database <name>; create database <name>;

this sometimes fails due to a pg_autovacuum process running on the background.


When this happens, the error returned is:

db2=# drop database db1; create database db1;
DROP DATABASE
ERROR:  source database "template1" is being accessed by other users



The logs shows that pg_autovacuum kicks in right after the drop database, but
right before the create database, causing the latter to fail:


2003-11-08 10:50:15 [1422] LOG:  unexpected EOF on client connection
2003-11-08 10:50:46 [1424] LOG:  connection received: host=<ip> port=<port>
2003-11-08 10:50:46 [1424] LOG:  connection authorized: user=<my_name>
database=db2
2003-11-08 10:50:52 [1424] LOG:  query: drop database db1;
2003-11-08 10:50:55 [1426] LOG:  connection received: host=[local] port=
2003-11-08 10:50:55 [1426] LOG:  connection authorized:
user=<pg_autovacuum_user> database=template1
2003-11-08 10:50:56 [1424] LOG:  query:  create database db1;
2003-11-08 10:50:56 [1424] ERROR:  source database "template1" is being
accessed by other users


Obviously, simply reentering 'create database db1' corrects the problem ;-)


db2=# select version();
                             version
------------------------------------------------------------------
 PostgreSQL 7.4beta3 on i586-pc-linux-gnu, compiled by GCC 2.95.3
(1 row)


pg_autovacuum is started using the options '-D -d2'




This may very well be expected behaviour, but I didn't find anything on it in
pg_autovacuum's README or TODO, so just in case it is a bug.......




--
Best,




Frank van Vugt


pgsql-general by date:

Previous
From: Rajesh Kumar Mallah
Date:
Subject: Problem creating ROWTYPE variable in plpgsql.
Next
From: Mike Mascari
Date:
Subject: PostgreSQL, Postgre and Apple