Skip site navigation (1) Skip section navigation (2)

intentional or oversight? pg_dump -c does not restore default priviliges on schema public

From: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: intentional or oversight? pg_dump -c does not restore default priviliges on schema public
Date: 2017-02-11 20:42:17
Message-ID: 3534542.o3cNaKiDID@techfox (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-general
L.S.

I noticed the following and wondered whether this is intentional or an 
oversight in pg_dump's '-c' option?

The clean option causes the public schema to be dropped and recreated, but 
this is done with the default schema priviliges, which are not the same as the 
ones assigned during create database:


*** USING PSQL

postgres=# create database publictest;

postgres=# \c publictest;

publictest=# \dn+
                          List of schemas
  Name  |  Owner   |  Access privileges   |      Description       
--------+----------+----------------------+------------------------
 public | postgres | postgres=UC/postgres+| standard public schema
        |          | =UC/postgres         | 
(1 row)



*** USING SHELL

host:~ # pg_dump -c -f /tmp/publictest -h localhost -Fp -U postgres publictest



*** USING PSQL

publictest=# \i /tmp/publictest

publictest=# \dn+
                        List of schemas
  Name  |  Owner   | Access privileges |      Description       
--------+----------+-------------------+------------------------
 public | postgres |                   | standard public schema
(1 row)

publictest=# grant usage on schema public to public;
GRANT
publictest=# grant create on schema public to public;
GRANT

testje=# \dn+
                          List of schemas
  Name  |  Owner   |  Access privileges   |      Description       
--------+----------+----------------------+------------------------
 public | postgres | postgres=UC/postgres+| standard public schema
        |          | =UC/postgres         | 
(1 row)



-- 

Best,




Frank.



Responses

pgsql-general by date

Next:From: Adrian KlaverDate: 2017-02-11 21:02:29
Subject: Re: intentional or oversight? pg_dump -c does not restore default priviliges on schema public
Previous:From: Pavel StehuleDate: 2017-02-11 19:04:19
Subject: Re: Custom shuffle function stopped working in 9.6

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group