CREATE DATABASE impossible if pgAdmin III is connected to the DB

From: Doncho Angelov <donangel(at)gmail(dot)com>
To: pgadmin-support(at)postgresql(dot)org
Subject: CREATE DATABASE impossible if pgAdmin III is connected to the DB
Date: 2005-04-23 14:47:11
Message-ID: 5240c50f050423074788fbdac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Hi pgAmind hackers!

I have a bug to report here:

I. Environment:

1. Two Windows XP SP2 machines, one is running PgSQL server, and the
other is the "workstation" on which I'm working and seeing the bug.
Both machines are in Wireless LAN, but I doubt it matters. Both have
firewall, but it also does not matter for this case :).

1.1. PgAdmin is working perfectly from my machine, no problems seen so far.

1.2. PgAdmin III 1.3.0 / 01.04.2005

1.3. Npgsql library for connecting .NET test application with the
given server, with small test application, which does:

// connecting to the DB
conn = new NpgsqlConnection("Server=192.168.1.7;Port=5432;User
Id=pgnet;Password=pgnetp;Database=test;");

// opens fine, both user pgnet and database "test" exist
conn->Open();

// Execute DB creation command
NpgsqlCommand * cmd = conn->CreateCommand();cmd->CommandText = "CREATE
DATABASE \"pgnet1\" WITH OWNER = test ENCODING = 'WIN' TABLESPACE =
pg_default;";
cmd->ExecuteReader(); // <== the error appears HERE, look for conditions below

2. The error is:

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"
PgAdmin III can create Databases without a problem!

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.

I am ready to assist, if needed!

Best regards,
--
Doncho
http://doncho.net

Browse pgadmin-support by date

  From Date Subject
Next Message Doncho Angelov 2005-04-23 17:27:53 CREATE DATABASE impossible if pgAdmin III is connected to the DB
Previous Message Andreas Pflug 2005-04-22 09:33:38 Re: Building pgadminIII v1.2.1