Re: docs: note ownership requirement for refreshing materialized views
Jonathan Katz <jonathan.katz@excoventures.com>
From: "Jonathan S. Katz" <jonathan.katz@excoventures.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Dian Fay <dian.m.fay@gmail.com>,
pgsql-hackers@lists.postgresql.org
Date: 2018-08-16T05:05:54Z
Lists: pgsql-hackers
> On Aug 15, 2018, at 9:15 PM, Michael Paquier <michael@paquier.xyz> wrote:
>
> On Wed, Aug 15, 2018 at 09:06:34PM -0400, Jonathan S. Katz wrote:
>> I played around with this feature a bit and did see this was the case.
>> Also while playing around I noticed the error message was as such:
>>
>> test=> REFRESH MATERIALIZED VIEW blah;
>> ERROR: must be owner of relation blah
>>
>> But it’s not a relation, it’s a materialized view. I attached a patch
>> that I think should fix this. Kudos to Dave Cramer who was
>> sitting next to me helping me to locate files and confirm assumptions.
>
> A relation may be a materialized view, no? The ACL check happens in
> RangeVarCallbackOwnsTable by the way (look at ExecRefreshMatView in
> matview.c).
Comment on the RangeVarCallbackOwnsTable func (abbr):
/*
* This is intended as a callback for RangeVarGetRelidExtended(). It allows
* the relation to be locked only if (1) it's a plain table, materialized
* view, or TOAST table and (2) the current user is the owner (or the
* superuser). This meets the permission-checking needs of CLUSTER, REINDEX
* TABLE, and REFRESH MATERIALIZED VIEW; we expose it here so that it can be
* used by all.
*/
So it’s sharing the permission checking needs amongst all of those commands.
As a user I could be confused if I saw the above error message, esp. because
the behavior of REFRESH .. is specific to materialized views.
Jonathan
Commits
-
Mention ownership requirements for REFRESH MATERIALIZED VIEW in docs
- b6c994af1f0d 9.3.25 landed
- 777192f0dd44 9.4.20 landed
- 82784f088986 9.5.15 landed
- 86e873c01650 9.6.11 landed
- 0dfaf8f763ae 10.6 landed
- b43cf1dcded9 11.0 landed
- ee8012481190 12.0 landed