Re: Template1 is locked when pgAdminIII is open

From: Mehul Doshi-A20614 <mehul(at)motorola(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Template1 is locked when pgAdminIII is open
Date: 2005-02-01 07:03:06
Message-ID: 653138C25D8AD6118292000347080A3714D0DA54@zin05exm02.corp.mot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 blocked till 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 the remote user to create the database. After that pgAdminIII can just refresh it's view to see the new db, similar to the way it refreshes when you drop a db.

Thanks & Regards,
Mehul

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

"Dave Page" <dpage(at)vale-housing(dot)co(dot)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 *besides your 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

Browse pgsql-bugs by date

  From Date Subject
Next Message Ricky 2005-02-01 09:16:43 BUG #1454: error in "select * from table where a1 like '%\%%' " ???
Previous Message Tom Lane 2005-02-01 04:45:59 Re: BUG #1453: NULLs in UNION query