| From: | "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org> |
|---|---|
| To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
| Cc: | pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Fix for REFRESH MATERIALIZED VIEW ownership error message |
| Date: | 2018-08-18 20:32:21 |
| Message-ID: | 3BF507A3-23D4-4B59-81A1-AE7531998E3C@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Aug 17, 2018, at 6:30 PM, 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?
Done. Please see attached.
> As it is cosmetic, my inclination would be not to backpatch it.
It’s cosmetic, but it’s a cosmetic bug: it incorrectly tells the user that they
must be the owner of the “relational” when in reality it’s the materialized view.
Thanks,
Jonathan
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Improve-error-messages-for-CREATE-OR-REPLACE-PROCEDU-v2.patch | application/octet-stream | 4.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jonathan S. Katz | 2018-08-18 20:34:21 | Re: Fix hints on CREATE PROCEDURE errors |
| Previous Message | Peter Eisentraut | 2018-08-18 20:22:28 | Re: Fix hints on CREATE PROCEDURE errors |