ALTER DATABASE ... RENAME: permission denied for superuser - Mailing list pgsql-bugs

From Alexander M. Pravking
Subject ALTER DATABASE ... RENAME: permission denied for superuser
Date
Msg-id 20050310104307.GA24145@dyatel.antar.bryansk.ru
Whole thread Raw
Responses Re: ALTER DATABASE ... RENAME: permission denied for superuser
Re: ALTER DATABASE ... RENAME: permission denied for superuser
List pgsql-bugs
Docs say: Only the database owner or a superuser can rename a database;
non-superuser owners must also have the CREATEDB privilege.

Looks like a superuser must have CREATEDB too:

fduch@~=# SELECT usesuper, usecreatedb from pg_user where usename = 'fduch';
 usesuper | usecreatedb
----------+-------------
 t        | f
(1 row)

fduch@~=# CREATE DATABASE test owner stat;
CREATE DATABASE
fduch@~=# ALTER DATABASE test RENAME TO work;
ERROR:  permission denied to rename database
fduch@~=# ALTER DATABASE test OWNER TO fduch ;
ALTER DATABASE
fduch@~=# ALTER DATABASE test RENAME TO work;
ERROR:  permission denied to rename database

At last:
fduch@~=# ALTER USER fduch CREATEDB ;
ALTER USER
fduch@~=# ALTER DATABASE test RENAME TO work;
ALTER DATABASE
fduch@~=# ALTER DATABASE work OWNER TO stat;
ALTER DATABASE
fduch@~=# ALTER DATABASE work RENAME TO test;
ALTER DATABASE

PostgreSQL 8.0.1 on i386-portbld-freebsd5.3, compiled by GCC cc (GCC) 3.4.2 [FreeBSD] 20040728


--
Fduch M. Pravking

pgsql-bugs by date:

Previous
From: cathy.hemsley@powerconv.alstom.com
Date:
Subject: Re: R: Fault when return strings over 256 characters in PLpgSQL
Next
From: Tom Lane
Date:
Subject: Re: ALTER DATABASE ... RENAME: permission denied for superuser