On 02/28/2012 10:52 AM, James B. Byrne wrote:
>
> This behaviour effectively means that only the superuser
> can restore databases in 9.1 or build them from scripts;
> unless the default template is altered. Is this desired?
> What then does GRANT CREATE DATABASE mean in 9.1 then? It
> is certainly at odds with the behaviour in 8.x releases.
No, you just did not run into the issue, probably because your template1
was just a straight clone of template0 with no added features
template1=# SELECT version();
version
--------------------------------------------------------------------------------------------------
PostgreSQL 8.4.9 on i686-pc-linux-gnu, compiled by GCC gcc (Ubuntu
4.4.3-4ubuntu5) 4.4.3, 32-bit
template1=# SELECT current_user;
current_user
--------------
postgres
template1=# CREATE TABLE perm_test(id integer, fld_1 text);
CREATE TABLE
template1=# \d
List of relations
Schema | Name | Type | Owner
--------+-----------+-------+----------
public | perm_test | table | postgres
template1=# \du
List of roles
Role name | Attributes | Member of
------------+-------------+--------------
aklaver | Create DB | {production}
template1=# \c - aklaver
psql (8.4.9)
You are now connected to database "template1" as user "aklaver".
template1=> CREATE DATABASE new_database;
CREATE DATABASE
template1=> \l
List of databases
Name | Owner | Encoding | Collation | Ctype |
Access privileges
--------------+----------+----------+-------------+-------------+-----------------------
new_database | aklaver | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template1=> \c new_database
psql (8.4.9)
You are now connected to database "new_database".
new_database=> \d
List of relations
Schema | Name | Type | Owner
--------+-----------+-------+----------
public | perm_test | table | postgres
(1 row)
The privileges inherit from the template.
>
>
--
Adrian Klaver
adrian.klaver@gmail.com