"holtzman" <fill-in-the-blanks_@_._> writes:
> [pg_dumpall script fails with]
> psql:dump_file:11: ERROR: CREATE DATABASE: source database "template1" is
> being accessed by other users
Hm. There is a bit of a race condition here, perhaps --- the pg_dumpall
script does
\connect template1 $DBOWNER
CREATE DATABASE foo;
and in the case of the very first database in the dump, the \connect is
redundant: before the \connect we were connected to template1 already.
In that case the old backend might not have finished shutting down by
the time the CREATE is issued, leading to this complaint.
This problem won't arise in dumps made with 7.1 pg_dump since they
will refer to template0, not template1, as the source for the CREATE
DATABASE copy ... and there shouldn't ever be anyone connected to
template0.
Evidently there is a risk with 7.0 dump scripts being brought forward,
however. Removing the redundant \connect command may do as a workaround
for them.
regards, tom lane