Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wmV65-000osU-16 for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2026 11:26:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wmV64-00BgxW-2Y for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2026 11:26:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wmV64-00BgxO-1T for pgsql-hackers@lists.postgresql.org; Wed, 22 Jul 2026 11:26:44 +0000 Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wmV61-00000000awZ-2J7l for pgsql-hackers@lists.postgresql.org; Wed, 22 Jul 2026 11:26:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Content-Type:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=2s45d6Sdng7aG7xU7t76t+bms7RmCGaJ6cW5zH7lJwo=; b=HJQcxhST7b+d6Kz54MsKxCslHz BVd+XnepiZeV0eZZRB4l6cJoGRVX+AWZBpEAL3Q6bpq+bHqpAVC2t53ksw663yWMoLXa19apGb50c DV3tK0qCYcd6uIHsB6ButJ6wJVGGdacei3snajev2VYl1i1+AG0USRLvIDXzE7s4sISjJ3ga2vFef mf9meGNxr228SD6nVleCc45VlENT8AYtHb8zRmLgC7SotXC0rjGRc8tb8k+9aSnmHC3SC8bTTB6GV PKi1ceB+KsyiwpFMBuTl8f161/8EEutIkWLhPg0TQDPQ6+WOxebOrkcQXlfKpWwK1Sjo5RaNl7evL pea3mtdQ==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wmV5v-002xgK-0J; Wed, 22 Jul 2026 11:26:35 +0000 Date: Wed, 22 Jul 2026 13:26:34 +0200 From: Christoph Berg To: PostgreSQL Hackers Cc: Zsolt Parragi Subject: Allow pg_read_all_stats to see database size in \l+ Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="bukXArRbhiisqidC" Content-Disposition: inline X-Debian-User: myon List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --bukXArRbhiisqidC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline psql \l+ didn't consider pg_read_all_stats when determining whether the user was allowed to see the database size. Split off from the "Available disk space per tablespace" patch since it's really an independent fix. Thanks Zsolt for pointing that out. This might be considered for backpatching. Christoph --bukXArRbhiisqidC Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename=v1-0001-Allow-pg_read_all_stats-to-see-database-size-in-l.patch From 9e6f09d62ecd373d80b14a8da39feb9f968c14a0 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Wed, 22 Jul 2026 13:16:16 +0200 Subject: [PATCH v1] Allow pg_read_all_stats to see database size in \l+ The server already allowed members of pg_read_all_stats to see the size of all databases, but psql's \l+ was too restrictive. --- src/bin/psql/describe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index a2f09c26369..ad9c8affb4f 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -986,7 +986,8 @@ listAllDbs(const char *pattern, bool verbose) printACLColumn(&buf, "d.datacl"); if (verbose) appendPQExpBuffer(&buf, - ",\n CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n" + ",\n CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT') OR\n" + " pg_catalog.pg_has_role('pg_read_all_stats', 'USAGE')\n" " THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n" " ELSE 'No Access'\n" " END as \"%s\"" -- 2.53.0 --bukXArRbhiisqidC--