postgres.git / summary / log / commit / refs

commit    054c1c3e650b2fe0c44570a59bc4ea05bd2ac142
Author:   Fujii Masao <fujii@postgresql.org>
Date:     Thu Sep 10 02:51:06 2026 +0000
First released in: 19.0

    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


src/backend/catalog/system_views.sql | 5 +++-- src/include/catalog/catversion.h | 2 +- src/test/regress/expected/rules.out | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 8612d99a890..ad340887f54 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -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, diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index c539af25327..f8aaf9aab02 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202609101 +#define CATALOG_VERSION_NO 202609102 #endif diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 1a29d46213e..4a8cc759d7b 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -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, [parent: 34c11958b6f1]