1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Fix pg_stat_progress_cluster command reporting for unprivileged users

Previously, when another session ran REPACK, CLUSTER, or VACUUM FULL and
the user lacked permission to view its progress details,
pg_stat_progress_cluster incorrectly reported the command as CLUSTER
instead of NULL.

pg_stat_progress_cluster is based on pg_stat_progress_repack and
translates REPACK into CLUSTER or VACUUM FULL depending on whether index
ordering is requested. However, this translation defaulted to CLUSTER,
incorrectly converting NULL commands returned for insufficient privileges
into CLUSTER.

Fix this translation to preserve a NULL command when the user lacks
permission to view the progress details.

Bump catalog version.

Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAN4CZFMzy2V_wvRCBW5K8=wVCk1-C7nq=8otXO=u+s_1KZHqyA@mail.gmail.com
Backpatch-through: 19
This commit is contained in:
Fujii Masao
2026-09-10 11:51:06 +09:00
parent 34c11958b6
commit 054c1c3e65
3 changed files with 7 additions and 5 deletions

View File

@@ -1397,8 +1397,9 @@ CREATE VIEW pg_stat_progress_cluster AS
datname,
relid,
CASE WHEN command IN ('CLUSTER', 'VACUUM FULL') THEN command
WHEN repack_index_relid = 0 THEN 'VACUUM FULL'
ELSE 'CLUSTER' END AS command,
WHEN command = 'REPACK' AND repack_index_relid = 0 THEN 'VACUUM FULL'
WHEN command = 'REPACK' THEN 'CLUSTER'
END AS command,
phase,
repack_index_relid AS cluster_index_relid,
heap_tuples_scanned,

View File

@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202609101
#define CATALOG_VERSION_NO 202609102
#endif

View File

@@ -2038,8 +2038,9 @@ pg_stat_progress_cluster| SELECT pid,
relid,
CASE
WHEN (command = ANY (ARRAY['CLUSTER'::text, 'VACUUM FULL'::text])) THEN command
WHEN (repack_index_relid = (0)::oid) THEN 'VACUUM FULL'::text
ELSE 'CLUSTER'::text
WHEN ((command = 'REPACK'::text) AND (repack_index_relid = (0)::oid)) THEN 'VACUUM FULL'::text
WHEN (command = 'REPACK'::text) THEN 'CLUSTER'::text
ELSE NULL::text
END AS command,
phase,
repack_index_relid AS cluster_index_relid,