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.

Thanks,

Jonathan

Attachment: 0001-treat-refresh-mat-view-as-mat-view.patch
Description: Binary data

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to