Re: CREATE DATABASE impossible if pgAdmin III is connected to the DB - Mailing list pgadmin-support

From Dave Page
Subject Re: CREATE DATABASE impossible if pgAdmin III is connected to the DB
Date
Msg-id E7F85A1B5FF8D44C8A1AF6885BC9A0E472C466@ratbert.vale-housing.co.uk
Whole thread Raw
In response to CREATE DATABASE impossible if pgAdmin III is connected to the DB  (Doncho Angelov <donangel@gmail.com>)
List pgadmin-support

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Doncho Angelov
> Sent: 23 April 2005 18:28
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] CREATE DATABASE impossible if
> pgAdmin III is connected to the DB
>
>
> If I have pgAdmin started and _connected_ to the server, then
> the command
> "CREATE DATABASE \"pgnet1\" WITH OWNER = test ENCODING = 'WIN'
> TABLESPACE = pg_default;"
> issued by _anyone_else_ ends up with error message
> "ERROR: 42501: must be superuser to create database for another user"

Right - this is PostgreSQL complaining as only superusers can create
databases with owners other than themselves

> PgAdmin III can create Databases without a problem!

Presumably you are logging into pgAdmin as a superuser though. All it
does is execute the CREATE DATABASE as you have (though through
C++/libpq rather than C#/Npgsql). PostgreSQL doesn't behave any
differently for pgAdmin over any other application.

> 3. Resolution: the only resolution found for now is to close
> pgAdmin III.
> If I close pgAdmin III, the command from above succeeds!
> If I open it again - the command fails with the same error message.
>
> The conclusion for me is: this is a bug in PgAdmin III. And I suppose
> it should be fixed, because I think no database can be created, if at
> least one user is connected to the server, and another one is trying
> to create a DB in the same time.

This sounds like another known issue which results in the following
error:

template1=# create database baa;
ERROR:  source database "template1" is being accessed by other users

Because pgAdmin connects to template1 initially by default, other users
will not be able to create new databases using template1 as the template
(which is also the default). There's nothing that can be done about
this, except to create the new database from a different template, or
select a different initial database for pgAdmin to connect to. Or exit
pgAdmin as you've found!

Regards, Dave.


pgadmin-support by date:

Previous
From: Doncho Angelov
Date:
Subject: CREATE DATABASE impossible if pgAdmin III is connected to the DB
Next
From: "Keith Worthington"
Date:
Subject: Error in display of schema qualified procedure