Re: pgsql: Improve default and empty privilege outputs in psql. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgsql: Improve default and empty privilege outputs in psql.
Date
Msg-id 3463048.1727200648@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Improve default and empty privilege outputs in psql.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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

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)"),

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Conflict detection for update_deleted in logical replication
Next
From: Peter Eisentraut
Date:
Subject: Re: Proposal to Enable/Disable Index using ALTER INDEX