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.94.2) (envelope-from ) id 1st9n9-00Dzb4-J2 for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2024 17:57:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1st9n7-00BS6N-0Z for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2024 17:57:37 +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.94.2) (envelope-from ) id 1st9n6-00BS5P-Ml for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2024 17:57:36 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1st9n2-000sgg-DL for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2024 17:57:35 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 48OHvSqK3463049; Tue, 24 Sep 2024 13:57:28 -0400 From: Tom Lane To: Christoph Berg cc: pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Improve default and empty privilege outputs in psql. In-reply-to: <3361177.1727195279@sss.pgh.pa.us> References: <3361177.1727195279@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 24 Sep 2024 12:27:59 -0400" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <3463020.1727200621.0@sss.pgh.pa.us> Date: Tue, 24 Sep 2024 13:57:28 -0400 Message-ID: <3463048.1727200648@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3463020.1727200621.1@sss.pgh.pa.us> I wrote: > Yes, that's the expectation. I'm sure we can think of a more > backwards-compatible way to test for empty datacl, though. Looks like the attached should be sufficient. As penance, I tried all the commands in describe.c against 9.2 (or the oldest supported server version), and none of them fail now. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="fix-ACL-printing-for-old-servers.patch"; charset="us-ascii" Content-ID: <3463020.1727200621.2@sss.pgh.pa.us> Content-Description: fix-ACL-printing-for-old-servers.patch diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index faabecbc76..6a36c91083 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -6678,7 +6678,7 @@ printACLColumn(PQExpBuffer buf, const char *colname) { appendPQExpBuffer(buf, "CASE" - " WHEN pg_catalog.cardinality(%s) = 0 THEN '%s'" + " WHEN pg_catalog.array_length(%s, 1) = 0 THEN '%s'" " ELSE pg_catalog.array_to_string(%s, E'\\n')" " END AS \"%s\"", colname, gettext_noop("(none)"), ------- =_aaaaaaaaaa0--