Bad permissions bug in 7.3 dump (and 7.4)?

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Bad permissions bug in 7.3 dump (and 7.4)?
Date: 2003-07-08 01:35:50
Message-ID: 039f01c344f1$4bc90c20$2800a8c0@mars
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Attachment Content-Type Size
script.sql application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-07-08 01:55:38 Re: pg_stat_activity
Previous Message Tatsuo Ishii 2003-07-08 01:14:26 Re: Latvian language & upper & lower