mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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 by19de0ab23c
. To fix this problem, this commit partially revertsff9618e82a
. 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
This commit is contained in:
@ -190,10 +190,7 @@ ANALYZE [ VERBOSE ] [ <replaceable class="parameter">table_and_columns</replacea
|
||||
analyze all tables in their databases, except shared catalogs.
|
||||
(The restriction for shared catalogs means that a true database-wide
|
||||
<command>ANALYZE</command> can only be performed by superusers and roles
|
||||
with privileges of <literal>pg_maintain</literal>.) If a role has
|
||||
permission to <command>ANALYZE</command> a partitioned table, it is also
|
||||
permitted to <command>ANALYZE</command> each of its partitions, regardless
|
||||
of whether the role has the aforementioned privileges on the partition.
|
||||
with privileges of <literal>pg_maintain</literal>.)
|
||||
<command>ANALYZE</command> will skip over any tables that the calling user
|
||||
does not have permission to analyze.
|
||||
</para>
|
||||
|
@ -137,10 +137,7 @@ CLUSTER [VERBOSE]
|
||||
on the table or be the table's owner, a superuser, or a role with
|
||||
privileges of the
|
||||
<link linkend="predefined-roles-table"><literal>pg_maintain</literal></link>
|
||||
role. If a role has permission to <command>CLUSTER</command> a partitioned
|
||||
table, it is also permitted to <command>CLUSTER</command> each of its
|
||||
partitions, regardless of whether the role has the aforementioned
|
||||
privileges on the partition. <command>CLUSTER</command> will skip over any
|
||||
role. <command>CLUSTER</command> will skip over any
|
||||
tables that the calling user does not have permission to cluster.
|
||||
</para>
|
||||
|
||||
|
@ -177,10 +177,7 @@ LOCK [ TABLE ] [ ONLY ] <replaceable class="parameter">name</replaceable> [ * ]
|
||||
MODE</literal> (or a less-conflicting mode as described in <xref
|
||||
linkend="explicit-locking"/>) is permitted. If a user has
|
||||
<literal>SELECT</literal> privileges on the table, <literal>ACCESS SHARE
|
||||
MODE</literal> is permitted. If a role has permission to lock a
|
||||
partitioned table, it is also permitted to lock each of its partitions,
|
||||
regardless of whether the role has the aforementioned privileges on the
|
||||
partition.
|
||||
MODE</literal> is permitted.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -306,11 +306,7 @@ REINDEX [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] { DA
|
||||
indexes on shared catalogs will be skipped unless the user owns the
|
||||
catalog (which typically won't be the case), has privileges of the
|
||||
<literal>pg_maintain</literal> role, or has the <literal>MAINTAIN</literal>
|
||||
privilege on the catalog. If a role has permission to
|
||||
<command>REINDEX</command> a partitioned table, it is also permitted to
|
||||
<command>REINDEX</command> each of its partitions, regardless of whether the
|
||||
role has the aforementioned privileges on the partition. Of course,
|
||||
superusers can always reindex anything.
|
||||
privilege on the catalog. Of course, superusers can always reindex anything.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -452,10 +452,7 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] [ ANALYZE ] [ <replaceable class="paramet
|
||||
vacuum all tables in their databases, except shared catalogs.
|
||||
(The restriction for shared catalogs means that a true database-wide
|
||||
<command>VACUUM</command> can only be performed by superusers and roles
|
||||
with privileges of <literal>pg_maintain</literal>.) If a role has
|
||||
permission to <command>VACUUM</command> a partitioned table, it is also
|
||||
permitted to <command>VACUUM</command> each of its partitions, regardless
|
||||
of whether the role has the aforementioned privileges on the partition.
|
||||
with privileges of <literal>pg_maintain</literal>.)
|
||||
<command>VACUUM</command> will skip over any tables that the calling user
|
||||
does not have permission to vacuum.
|
||||
</para>
|
||||
|
Reference in New Issue
Block a user