BUG #12898: Failure loading materialized view with pg_restore

From: jgpedro(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #12898: Failure loading materialized view with pg_restore
Date: 2015-03-25 15:48:12
Message-ID: 20150325154812.2490.65573@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 12898
Logged by: José Pedro
Email address: jgpedro(at)gmail(dot)com
PostgreSQL version: 9.3.6
Operating system: Ubuntu 14.04.2 LTS 64-bit
Description:

pg_restore of a materialized view fails with "permission denied for relation
<X>".

The same problem as discussed in this thread:

http://www.postgresql.org/message-id/flat/11166(dot)1424357659(at)sss(dot)pgh(dot)pa(dot)us#11166(dot)1424357659@sss.pgh.pa.us

Problem identified as:

- Tables ACLs restored after materialized views creation;

- Owner of materialized view only gets permission to table after the ACLs
being restored.

As Tom Lane said
(http://www.postgresql.org/message-id/11166.1424357659@sss.pgh.pa.us)

"We need to rethink the ordering rules here. I believe that not dumping
ACLs till late is an intentional choice to avoid corner cases with regular
tables (eg what if user has revoked INSERT on a table), but it doesn't
work so well for matviews.

One possible avenue to a fix is to also postpone the assignment of the
matview's owner, but I'm not sure that that's a great idea from a security
standpoint.

A possibly safer idea is just to put all REFRESHes after all ACL updates.
If things fail then, well, they'd have failed anyway."

I'm opening a bug report so this issue won't be forgotten ;)

Browse pgsql-bugs by date

  From Date Subject
Next Message Pedro Gimeno 2015-03-25 16:22:07 Re: Re: BUG #12885: The result of casting a double to an integer depends on the database version
Previous Message Kevin Grittner 2015-03-25 15:41:10 Re: "no-slave yet" early CREATE TABLE transaction gets blocked when synchronous replication