Re: Template1 is locked when pgAdminIII is open - Mailing list pgsql-bugs

From Mehul Doshi-A20614
Subject Re: Template1 is locked when pgAdminIII is open
Date
Msg-id 653138C25D8AD6118292000347080A3714D0DA54@zin05exm02.corp.mot.com
Whole thread Raw
In response to Template1 is locked when pgAdminIII is open  (Mehul Doshi-A20614 <mehul@motorola.com>)
List pgsql-bugs
Hi,

I amn't running two copies of pgAdmin at same time. The problem is

The postgres server is running on a separate Windows XP system. I cannot be sure if pgAdmin is open or not on that
system.I use the console way to create a database on that system. 

createdb mehultest -h pcdsk506 -U postgres -W postgres
Password:
createdb: database creation failed: ERROR:  source database "template1" is being
 accessed by other users

The admin of that system might be cleaning up databases or viewing or modifying using pgAdminIII. In such a case, I am
blockedtill pgAdminIII is closed by the system admin using the remote system.  

I think it might be a good idea for pgAdminIII to use some shared lock which can be used with createdb thereby allowing
theremote user to create the database. After that pgAdminIII can just refresh it's view to see the new db, similar to
theway it refreshes when you drop a db. 

Thanks & Regards,
Mehul


-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Monday, January 31, 2005 10:10 PM
To: Dave Page
Cc: Mehul Doshi-A20614; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] Template1 is locked when pgAdminIII is open


"Dave Page" <dpage@vale-housing.co.uk> writes:
> pgAdmin uses template1 by default as it is the only accessible
> database that we can be sure will exist. There are 2 solutions to your
> problem:

> 1) Change your pgAdmin connection to use a different default database.

> 2) Select a different database to use as the template when creating a
> new one.

He shouldn't really be getting that error though, as CREATE DATABASE only complains if there is another connection
*besidesyour own* to the template database. 

I think the real answer is something more along the lines of "don't run two copies of pgAdmin at once".

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1453: NULLs in UNION query
Next
From: Peter Eisentraut
Date:
Subject: Re: [Feed-back] Installing PostgreSQL 8.0.0 on SPARC/Solaris. Configure and install issues.