| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: psql: Allow pg_read_all_stats to see database size in \l+ |
| Date: | 2026-07-25 10:14:08 |
| Message-ID: | E1wnZOS-00000000EUI-0fRN@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
psql: Allow pg_read_all_stats to see database size in \l+
pg_database_size() allows access to users who have either CONNECT
privilege on the target database or privileges of the pg_read_all_stats
role. However, previously, psql's \l+ checked only for CONNECT,
so users with privileges of pg_read_all_stats still saw "No Access" for
databases they could not connect to.
Fix this by making \l+ also check
pg_has_role('pg_read_all_stats', 'USAGE'), matching
pg_database_size()'s permission rules.
For back branches, emit the pg_read_all_stats check only when
connected to PostgreSQL 10 or later, since earlier releases do not have
that predefined role.
Backpatch to all supported versions.
Author: Christoph Berg <myon(at)debian(dot)org>
Reviewed-by: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/amCo6qRmnfPVk4-V@msg.df7cb.de
Backpatch-through: 14
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/e6e8a3078b094f209f6e40822c1655ebd34429f5
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 5 +++--
src/bin/psql/describe.c | 4 ++++
2 files changed, 7 insertions(+), 2 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-07-25 10:14:19 | pgsql: psql: Allow pg_read_all_stats to see database size in \l+ |
| Previous Message | Fujii Masao | 2026-07-25 10:13:49 | pgsql: psql: Allow pg_read_all_stats to see database size in \l+ |