Re: Fix for REFRESH MATERIALIZED VIEW ownership error message

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix for REFRESH MATERIALIZED VIEW ownership error message
Date: 2018-08-17 23:32:09
Message-ID: CADK3HHL_aBbYqgq9vtHWVPxhvdh6D0EMBQz0QhpjepubBA1EQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On Fri, 17 Aug 2018 at 18:30, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> 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?
>
+1

>
> 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.
>
> The only place this is used is in aclcheck_error
case OBJECT_MATVIEW:
msg = gettext_noop("permission denied for materialized view %s");
break;

Dave

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-08-17 23:35:12 Re: Fix for REFRESH MATERIALIZED VIEW ownership error message
Previous Message Wu Ivy 2018-08-17 23:25:05 Getting NOT NULL constraint from pg_attribute