Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>, Ted Yu <yuzhihong@gmail.com>, Pavel Luzanov <p.luzanov@postgrespro.ru>, Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers@postgresql.org
Date: 2023-06-20T05:26:42Z
Lists: pgsql-hackers
On Mon, Jun 19, 2023 at 02:55:34PM -0700, Nathan Bossart wrote: > In v4 of the patch set, I moved the skip_privs flag refactoring to 0001. I > intend to commit this tomorrow unless there is additional feedback. Fine by me. 0001 looks OK seen from here. > These object_ownercheck() calls were removed because they were redundant, > as owners have all privileges by default. Privileges can be revoked from > the owner, so an extra ownership check would effectively bypass the > relation's ACL in that case. I looked around and didn't see any other > examples of a combined ownership and ACL check like we were doing for > MAINTAIN. The only thing that gives me pause is that the docs call out > ownership as sufficient for some maintenance commands. With these patches, > that's only true as long as no one revokes privileges from the owner. IMO > we should update the docs and leave out the ownership checks since MAINTAIN > is now a grantable privilege like any other. WDYT? TBH, I have a mixed feeling about this line of reasoning because MAINTAIN is much broader and less specific than TRUNCATE, for instance, being spawned across so much more operations. As you say, owners of a relation have the MAINTAIN right by default, but they would not be able to run any maintenance operations if somebody has revoked their MAINTAIN right to do so, even if they are the owners of the so-said relation. Perhaps that's OK in the long run, still I have mixed feeling about whether that's the best decision we can take here, especially because MAINTAIN impacts VACUUM, ANALYZE, CLUSTER, REFRESH MATVIEW, REINDEX and LOCK. Some users may find that surprising as they used to have more control over these operations as owners of the relations worked on. -- Michael
Commits
-
Improve privilege documentation for maintenance commands.
- c2122aae636d 16.0 landed
-
Fix cache lookup hazards introduced by ff9618e82a.
- 4dbdb82513b6 16.0 landed
-
Move bool parameter for vacuum_rel() to option bits.
- 5b1a87994312 16.0 landed
-
Fix MAINTAIN privileges for toast tables and partitions.
- ff9618e82a46 16.0 landed
-
Add grantable MAINTAIN privilege and pg_maintain role.
- 60684dd834a2 16.0 landed