Bad permissions bug in 7.3 dump (and 7.4)? - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Bad permissions bug in 7.3 dump (and 7.4)?
Date
Msg-id 039f01c344f1$4bc90c20$2800a8c0@mars
Whole thread Raw
List pgsql-hackers
This:

create user bob;
create user sue;
\c - bob
create table parent (a int4 primary key);
create table child(b int4 references parent);
\c - chriskl   (I'm superuser)
alter table child owner to sue;

Now, do a dump:

pg_dump test > script.sql  (attached)

And try to restore it:

bash-2.03$ psql test < script.sql
You are now connected as new user chriskl.
REVOKE
GRANT
You are now connected as new user bob.
SET
CREATE TABLE
You are now connected as new user sue.
SET
CREATE TABLE
You are now connected as new user bob.
SET
You are now connected as new user sue.
SET
You are now connected as new user bob.
SET
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index
'parent_pkey' for table 'parent'
ALTER TABLE
You are now connected as new user sue.
SET
NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR:  parent: permission denied

The solution (it seems to me) is to add all the foreign keys under the
superuser account, NOT the owner of either table account.

Chris

pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: again: Bug #943: Server-Encoding from EUC_TW
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: pg_stat_activity