pgsql: Fix MAINTAIN privileges for toast tables and partitions. - Mailing list pgsql-committers

From Jeff Davis
Subject pgsql: Fix MAINTAIN privileges for toast tables and partitions.
Date
Msg-id E1pGbqQ-003aCb-3I@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Add 250c8ee07ed to git-blame-ignore-revs
Next
From: Tatsuo Ishii
Date:
Subject: pgsql: Doc: fix typo in backup.sgml.