Re: Failure loading materialized view with pg_restore - Mailing list pgsql-general

From Tom Lane
Subject Re: Failure loading materialized view with pg_restore
Date
Msg-id 1380.1424273673@sss.pgh.pa.us
Whole thread Raw
In response to Failure loading materialized view with pg_restore  (Brian Sutherland <brian@vanguardistas.net>)
Responses Re: Failure loading materialized view with pg_restore  (Brian Sutherland <brian@vanguardistas.net>)
List pgsql-general
Brian Sutherland <brian@vanguardistas.net> writes:
> If I run this set of commands against PostgreSQL 9.4.1 I pg_restore
> throws an error with a permission problem. Why it does so is a mystery
> to me, given that the user performing the restore is a superuser:

The same thing would happen without any dump and restore:

regression=# create user nobody;
CREATE ROLE
regression=# CREATE TABLE x (y int);
CREATE TABLE
regression=# CREATE MATERIALIZED VIEW myview AS select * from x;
SELECT 0
regression=# ALTER TABLE myview OWNER TO "nobody";
ALTER TABLE
regression=# REFRESH MATERIALIZED VIEW myview;
ERROR:  permission denied for relation x

User "nobody" does not have permission to read table x, so the REFRESH
fails, because the view's query executes as the view's owner.

            regards, tom lane


pgsql-general by date:

Previous
From: Medhavi Mahansaria
Date:
Subject: #Personal#: Reg: Multiple queries in a transaction
Next
From: Bill Moran
Date:
Subject: Re: #Personal#: Reg: Multiple queries in a transaction