pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix MAINTAIN privileges for toast tables and partitions.
Date: Sat, 14 Jan 2023 08:24:54 +0000
Message-ID: <E1pGbqQ-003aCb-3I@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1pGbqQ-003aCb-3I@gemulon.postgresql.org>
Permalink:  ../E1pGbqQ-003aCb-3I@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pGbqQ-003aCb-3I@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: jdavis@postgresql.org
  Subject: Re: pgsql: Fix MAINTAIN privileges for toast tables and partitions.
  In-Reply-To: <E1pGbqQ-003aCb-3I@gemulon.postgresql.org>
  References: <E1pGbqQ-003aCb-3I@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox