Bug #489: pg_dump places GRANT queries before CREATE VIEW

Started by PostgreSQL Bugs Listover 24 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Edwin Grubbs (egrubbs@rackspace.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
pg_dump places GRANT queries before CREATE VIEW

Long Description
System Configuration
---------------------
Architecture (example: Intel Pentium) : AMD Athlon

Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.7 ELF

PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-7.1.2

Compiler used (example: gcc 2.8.0) : egcs-1.1.2

Please enter a FULL description of your problem:
------------------------------------------------
After a pg_dumpall and restore, all the permissions on all the views
were gone. The permissions for all the other tables were fine.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
createuser nobody
createdb test
psql test -c 'create view myview as select 1 as val;'
psql test -c 'grant all on myview to nobody;'
pg_dump test > test.sql
createdb test2
psql test2 < test.sql

psql test2 -c '\z'

This will show no access permissions for myview in the test2 database.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

At least in the test case, the problem is caused by the GRANT queries
being issued before CREATE VIEW; therefore, pg_dump just needs to
reorder the queries.

Sample Code

No file was uploaded with this report

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #489: pg_dump places GRANT queries before CREATE VIEW

pgsql-bugs@postgresql.org writes:

pg_dump places GRANT queries before CREATE VIEW

Fixed in 7.1.3.

regards, tom lane