Re: restore pg_dumpall problem with update 7.0.3 to 7.1.1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: restore pg_dumpall problem with update 7.0.3 to 7.1.1
Date: 2001-05-28 17:35:43
Message-ID: 13533.991071343@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"holtzman" <fill-in-the-blanks_(at)_(dot)_> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Deric Sullivan 2001-05-28 17:50:39 SNMP MIBs and Postgresql
Previous Message Dave Cramer 2001-05-28 17:08:23 Re: Seq Scan