pgsql: Fix MAINTAIN privileges for toast tables and partitions.

From: Jeff Davis <jdavis(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix MAINTAIN privileges for toast tables and partitions.
Date: 2023-01-14 08:24:54
Message-ID: E1pGbqQ-003aCb-3I@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix MAINTAIN privileges for toast tables and partitions.

Commit 60684dd8 left loose ends when it came to maintaining toast
tables or partitions.

For toast tables, simply skip the privilege check if the toast table
is an indirect target of the maintenance command, because the main
table privileges have already been checked.

For partitions, allow the maintenance command if the user has the
MAINTAIN privilege on the partition or any parent.

Also make CLUSTER emit "skipping" messages when the user doesn't have
privileges, similar to VACUUM.

Author: Nathan Bossart
Reported-by: Pavel Luzanov
Reviewed-by: Pavel Luzanov, Ted Yu
Discussion: https://postgr.es/m/20230113231339.GA2422750@nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ff9618e82a466fc9c635f9f087776e57b21e4f14

Modified Files
--------------
doc/src/sgml/ref/analyze.sgml | 5 +++-
doc/src/sgml/ref/cluster.sgml | 17 ++++++++---
doc/src/sgml/ref/lock.sgml | 5 +++-
doc/src/sgml/ref/reindex.sgml | 6 +++-
doc/src/sgml/ref/vacuum.sgml | 5 +++-
src/backend/commands/cluster.c | 35 +++++++++++++++-------
src/backend/commands/indexcmds.c | 22 +++++++-------
src/backend/commands/lockcmds.c | 8 +++++
src/backend/commands/tablecmds.c | 30 +++++++++++++++++--
src/backend/commands/vacuum.c | 21 ++++++++-----
src/include/commands/tablecmds.h | 1 +
.../expected/cluster-conflict-partition.out | 6 ++--
.../specs/cluster-conflict-partition.spec | 5 +---
src/test/regress/expected/cluster.out | 4 ++-
src/test/regress/expected/vacuum.out | 18 -----------
src/test/regress/sql/cluster.sql | 2 ++
16 files changed, 126 insertions(+), 64 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tatsuo Ishii 2023-01-14 09:17:57 pgsql: Doc: fix typo in backup.sgml.
Previous Message David G. Johnston 2023-01-14 01:29:00 Re: pgsql: Add new GUC createrole_self_grant.