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 1wmY6D-000qXM-0W for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2026 14:39:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wmY6C-00CgJR-2H for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Jul 2026 14:39:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wmY6C-00CgI0-0K for pgsql-hackers@lists.postgresql.org; Wed, 22 Jul 2026 14:39:04 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wmY69-00000001Qro-02X2 for pgsql-hackers@lists.postgresql.org; Wed, 22 Jul 2026 14:39:02 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 038611D000D1; Wed, 22 Jul 2026 10:38:59 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 22 Jul 2026 10:39:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1784731139; x= 1784817539; bh=kCcfw6ODk6F5EYXEfupiWDD5fBlwQ0UnT1T1By71zy8=; b=N XsV0c9yg2ERG0rN1s9G10AchrGrB4zdRst37863KpDplhK4GPF+JJGQQk06+9+3S 6d69xzJqoKIBRA4njVNsi35OhYG3lpZWVWFiG5PornGZupz/tpUiNodE6z1TGJZC iJJ6721Puhebqfq8AUHvVvWL2X569AFQ3PdlGxLZG0unziHPWxsIx4lhwf1qnCMS 1HAvnpnR9h6jSFV5iIDFqsuA+0ol6KNlK3kv0um4p/CZiep2iO4/eyQ1JOxTkI17 Hlk7zBuUBEk4233K1VQ2hWa4gbUHPf459c9xjAt3v3nrM1chLNNNToubBuEqmtnp m2u7DcNLS3fSy8qRNnT+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1784731139; x=1784817539; bh=k Ccfw6ODk6F5EYXEfupiWDD5fBlwQ0UnT1T1By71zy8=; b=n3zpy+FVvmg6WaJBq svkAUZBFCGojq5V+jNFjWYVAWYUcZlh8qh79Rg8kI0vK5wt4nCh/LuzeCLNOrMkj FLxH+oZTh2cbscxwM9QEs5E3iceR9GHX2bIXMhxjzr1i4v9tchYUY0MH2273co14 IJOdOv9B7s3QTzFD6gOidYaUKz9CosHlzF/bYCuMnEtYFHs1WDuTUZ5SHUuZGpWj +FjBQGmh4l3CN2ULX2wmrt8k9HwPrZnydTXrT4YRUBgwPAhr6cyegG8Wzo72QH5M YJttgOdoh/Aqo6u7sxm6+uaGPIg5eZ2GvWO7dKNUQtlYlOj3yxP97IFNQat4meae uFnmQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGZWK3sLyEdh2hovEHXURGch/z4Y96WJKJ4EWxOzFYttRzzCfxmaX6A54w3Bkf7Ps enxDofbwsUMGxOY2g3S5DGsX6CTtzi7JgopYXwaYwDLFmYUr5OtcXpXnyho9FsUL+LhCNP tQn0eBLMGbCebwo9qsox8Eh/z2FSYJxHkWrC4xXDsufbeQ1zEyrnD7f4tdmqTCuSHX9p+l 4gO45o485cDlN60SNqK9sPd6srOG4XHp2waAwB8PBgU5fUTnAd0s5Qc8IZxFJGyl0v8jcW MxshXvJyTHLXfWwfU6eomUIgbiEBPYyAjrDnchElaJR8TIA4/dg35zjOKTABMqKb+vELJ4 9OyPR1OSi0KueA/bM1ZdEC9w6P+6ZVc3Op6gDOdX6zUVjSXKcac8HaBtP23xOivo/8O7z9 0ZQMNfXqrV1hMLzq6q7ICCTVDShJToE/HWby/bfhN0wcFY+Mv5xPjWn8UmJZuhMYhQhede LJLUxJbHfBetto/mVYFRmc7mN8FdCyr/fOqYj9auLb7EIPOCpw/EQxJKI+d3NHA+MY+ti/ NMml21WoeAkz3/YKl4GrZY1HVA1pGHLbzKEr5/Lqcf9YN50ZYzwC34e6dh8aTvOOdLjnX3 GaClJOokUT7MpVVz4vdZ34FC6XfmyrIFt+HF2Kb5zMQ+CFqo5I2poLXI3vyQ X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Jul 2026 10:38:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1784731135; bh=V5hUtWVHaLaRKrEDFpJd4qCZYrcCsP/kdQj1HEF53LE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=2OzYBsg1wR/5v/wETdewXT9mOe87c7F09pLRMtl10y8d32Y8Me8uismJCV1eaaPWF l9EpOw+VKjwLuyYS/PDiP/AVRqrhfTXtTuwCteIQs1+i+LzGVyY4pZjQF9EE5mkEbv LfpBSwVjW5F3B1EJAa0PwQpLouelSh0Ir/U/KGw6NVet/LOyGT5nDn8gGqcWpQsBMM o0bMvklt1GeQHvTWDDLRetZqbXtwdLIem8fsMmZ1/9+lU620mc++cPX6PPCjqfhnBP +8RkTfbrUfU8vlsTbNvuPUMbvZc6w8vUdeDq01jmWMrVDzQgu9vtMYC+vJ32qQTtYE X/TjHvNrvoPSQ== Received: by ida.kurilemu.internal (Postfix, from userid 1000) id B383BB0000B; Wed, 22 Jul 2026 16:38:55 +0200 (CEST) Date: Wed, 22 Jul 2026 16:38:55 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Christoph Berg Cc: Fujii Masao , PostgreSQL Hackers , Zsolt Parragi Subject: Re: Allow pg_read_all_stats to see database size in \l+ Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Jul-22, Christoph Berg wrote: > Thanks for the review! > > Re: Fujii Masao > > The pg_read_all_stats check should be fine in master, since psql there > > no longer supports pre-v10 servers, which don't have that role. But, > > if this is backpatched, psql still needs to work with pre-v10 servers, > > so we'll probably need a server version check (e.g., pset.sversion >= 100000) > > before checking for pg_read_all_stats, at least in the older stable branches. > > The SQL-generating code there is already quite complex, and since no > one complained, perhaps just skip the backpatching if it's complicated. I think it's simple enough: @@ -1069,12 +1069,16 @@ listAllDbs(const char *pattern, bool verbose) appendPQExpBufferStr(&buf, " "); printACLColumn(&buf, "d.datacl"); if (verbose && pset.sversion >= 80200) + { appendPQExpBuffer(&buf, ",\n CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')\n" + " %s" " THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))\n" " ELSE 'No Access'\n" " END as \"%s\"", + pset.sversion >= 100000 ? "OR pg_catalog.pg_has_role('pg_read_all_stats', 'USAGE')\n" : "", gettext_noop("Size")); + } if (verbose && pset.sversion >= 80000) appendPQExpBuffer(&buf, ",\n t.spcname as \"%s\"", -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/