pgsql: Fix cache lookup hazards introduced by ff9618e82a.

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема pgsql: Fix cache lookup hazards introduced by ff9618e82a.
Дата
Msg-id E1qCT7H-0038ei-Uh@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix cache lookup hazards introduced by ff9618e82a.

ff9618e82a introduced has_partition_ancestor_privs(), which is used
to check whether a user has MAINTAIN on any partition ancestors.
This involves syscache lookups, and presently this function does
not take any relation locks, so it is likely subject to the same
kind of cache lookup failures that were fixed by 19de0ab23c.

To fix this problem, this commit partially reverts ff9618e82a.
Specifically, it removes the partition-related changes, including
the has_partition_ancestor_privs() function mentioned above.  This
means that MAINTAIN on a partitioned table is no longer sufficient
to perform maintenance commands on its partitions.  This is more
like how privileges for maintenance commands work on supported
versions.  Privileges are checked for each partition, so a command
that flows down to all partitions might refuse to process them
(e.g., if the current user doesn't have MAINTAIN on the partition).

In passing, adjust a few related comments and error messages, and
add a test for the privilege checks for CLUSTER on a partitioned
table.

Reviewed-by: Michael Paquier, Jeff Davis
Discussion: https://postgr.es/m/20230613211246.GA219055%40nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4dbdb82513b65ab3a29e431f0233009c8a0fa890

Modified Files
--------------
doc/src/sgml/ref/analyze.sgml                      |  5 +---
doc/src/sgml/ref/cluster.sgml                      |  5 +---
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                     | 12 ++++----
src/backend/commands/indexcmds.c                   | 27 ++++++++---------
src/backend/commands/lockcmds.c                    |  8 -----
src/backend/commands/tablecmds.c                   | 34 +++-------------------
src/backend/commands/vacuum.c                      | 10 ++-----
src/include/commands/tablecmds.h                   |  1 -
.../expected/cluster-conflict-partition.out        | 14 ++++-----
.../specs/cluster-conflict-partition.spec          |  7 +++--
src/test/regress/expected/cluster.out              |  7 ++++-
src/test/regress/expected/create_index.out         |  4 +--
src/test/regress/expected/privileges.out           |  8 ++---
src/test/regress/expected/vacuum.out               | 18 ++++++++++++
src/test/regress/sql/cluster.sql                   |  3 ++
18 files changed, 74 insertions(+), 105 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: pgsql: Doc: Clarify the behavior of triggers/rules in a logical subscri
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: Fix incorrect error message in libpq_pipeline