Re: fix and document CLUSTER privileges

Gilles Darold <gilles@migops.com>

From: Gilles Darold <gilles@migops.com>
To: Nathan Bossart <nathandbossart@gmail.com>, Gilles Darold <gilles@migops.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Justin Pryzby <pryzby@telsasoft.com>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-01-11T13:22:26Z
Lists: pgsql-hackers
Le 06/01/2023 à 01:26, Nathan Bossart a écrit :
> Apparently I forgot to run all the tests before posting v4.  Here is a new
> version of the patch that should pass all tests.

Review status:


The patch applies and compiles without issues, make check and 
checkinstall tests are running without error.

It aim to limit the permission check to run the CLUSTER command on a 
partition to ownership and the MAINTAIN privilege. Which it actually does.

In commit 3f19e17, to have CLUSTER ignore partitions not owned by 
caller, there was still a useless check of database ownership or shared 
relation in get_tables_to_cluster_partitioned().


Documentation have been updated to explain the conditions of a 
successful execution of the CLUSTER command.


Additionally this patch also adds a warning when a partition is skipped 
due to lack of permission just like VACUUM is doing:

     WARNING:  permission denied to vacuum "ptnowner2", skipping it

with CLUSTER now we have the same message:

     WARNING:  permission denied to cluster "ptnowner2", skipping it

Previous behavior was to skip the partition silently.


Tests on the CLUSTER command have been modified to skip warning messages 
except partially in src/test/regress/sql/cluster.sql to validate the 
presence of the warning.


I'm moving this commitfest entry to Ready for Committers.


Regards,

-- 
Gilles Darold




Commits

  1. Clarify documentation for CLUSTER on partitioned tables.

  2. Fix MAINTAIN privileges for toast tables and partitions.

  3. Have CLUSTER ignore partitions not owned by caller