Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Pavel Luzanov <p.luzanov@postgrespro.ru>, Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers@postgresql.org
Date: 2022-12-17T06:04:08Z
Lists: pgsql-hackers
Attachments
- fix_partition_and_toast_privs.patch (text/x-diff) patch
On Thu, Dec 15, 2022 at 10:10:43AM -0800, Jeff Davis wrote: > The proposal to skip privilege checks for partitions would be > consistent with INSERT, SELECT, REINDEX that flow through to the > underlying partitions regardless of permissions/ownership (and even > RLS). It would be very minor behavior change on 15 for this weird case > of superuser-owned partitions, but I doubt anyone would be relying on > that. I've attached a work-in-progress patch that aims to accomplish this. Instead of skipping the privilege checks, I added logic to trawl through pg_inherits and pg_class to check whether the user has privileges for the partitioned table or for the main relation of a TOAST table. This means that MAINTAIN on a partitioned table is enough to execute maintenance commands on all the partitions, and MAINTAIN on a main relation is enough to execute maintenance commands on its TOAST table. Also, the maintenance commands that flow through to the partitions or the TOAST table should no longer error due to permissions when the user only has MAINTAIN on the paritioned table or main relation. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com
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