Re: Fix for REFRESH MATERIALIZED VIEW ownership error message - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Fix for REFRESH MATERIALIZED VIEW ownership error message
Date
Msg-id 20180817223030.5lceyv43fvy6fvsa@alvherre.pgsql
Whole thread Raw
In response to Fix for REFRESH MATERIALIZED VIEW ownership error message  ("Jonathan S. Katz" <jkatz@postgresql.org>)
Responses Re: Fix for REFRESH MATERIALIZED VIEW ownership error message
Re: Fix for REFRESH MATERIALIZED VIEW ownership error message
List pgsql-hackers
On 2018-Aug-17, Jonathan S. Katz wrote:

> Hi,
> 
> I Initially pointed out here[1] that running REFRESH MATERIALIZED VIEW as a
> non-superuser or table owner yields the following message:
> 
>     test=> REFRESH MATERIALIZED VIEW blah;
>     ERROR: must be owner of relation blah
> 
> The error message should say "...owner of materialized view..."
> 
> The attached patch corrects this by setting the "relkind" for the
> REFRESH MATERIALIZED VIEW command to be "OBJECT_MATVIEW" so that the aclcheck
> returns the appropriate error message. The updated patch can be tested as such:
> 
>     CREATE ROLE bar LOGIN;
>     CREATE TABLE a (x int);
>     CREATE MATERIALIZED VIEW b AS SELECT * FROM a;
>     \c - bar
>     REFRESH MATERIALIZED VIEW b;
>     ERROR:  must be owner of materialized view b
> 
> I'm happy to generate the backpatches for it but wanted to receive feedback
> first.

Maybe add your test to some regress/ file?

As it is cosmetic, my inclination would be not to backpatch it.
However, I don't quite see how this patch can possibly fix the problem,
since the new struct member is not used anywhere AFAICT.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] Improve geometric types
Next
From: Wu Ivy
Date:
Subject: Getting NOT NULL constraint from pg_attribute