pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: marian.krucina@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13907: Restore materialized view throw permission denied
Date: Tue, 02 Feb 2016 16:14:07 +0000
Message-ID: <20160202161407.2778.24659@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13907
Logged by:          Marian Krucina
Email address:      marian.krucina@gmail.com
PostgreSQL version: 9.5.0
Operating system:   Centos
Description:        

Hi,

restore (9.4.5, 9.5.0) or pg_upgrade (9.4.5 to 9.5.0) fail on CREATE
MATERIALIZED VIEW.
This is similar to:
http://www.postgresql.org/message-id/11166.1424357659@sss.pgh.pa.us

Problem is, when view runs as user definer.
Is possible move 'CREATE MATERIALIZED VIEW' in a dump to end?

Scenario:

CREATE ROLE role1;
CREATE ROLE role2;
CREATE TABLE table1(i INT);
CREATE VIEW view1 AS SELECT * FROM table1;
ALTER TABLE table1 OWNER TO role1;
ALTER VIEW view1 OWNER TO role2;
GRANT SELECT ON table1 TO role2;
CREATE MATERIALIZED VIEW view2 AS SELECT * FROM view1;
ALTER MATERIALIZED VIEW view2 OWNER TO role2;

# pg_dump -U postgres test -f test.sql
# psql -U postgres test2 -f test.sql -1 -e
...
CREATE MATERIALIZED VIEW view2 AS
 SELECT view1.i
   FROM view1
  WITH NO DATA;
psql:test.sql:221: ERROR:  permission denied for relation table1




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (21+ messages)  latest in thread

Message-ID: <20160202161407.2778.24659@wrigleys.postgresql.org>
Permalink:  ../20160202161407.2778.24659@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160202161407.2778.24659@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: marian.krucina@gmail.com
  Subject: Re: BUG #13907: Restore materialized view throw permission denied
  In-Reply-To: <20160202161407.2778.24659@wrigleys.postgresql.org>
  References: <20160202161407.2778.24659@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox