1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-08 07:21:33 +03:00

Fix psql describe commands' handling of ACL columns for old servers.

Commit d1379ebf4 carelessly broke printACLColumn for pre-9.4 servers,
by using the cardinality() function which we introduced in 9.4.
We expect psql's describe-related commands to work back to 9.2, so
this is bad.  Use the longstanding array_length() function instead.

Per report from Christoph Berg.  Back-patch to v17.

Discussion: https://postgr.es/m/ZvLXYglRS6hMMhtr@msg.df7cb.de
This commit is contained in:
Tom Lane 2024-09-24 17:21:38 -04:00
parent ceeaaed87a
commit 1591b38d17

View File

@ -6678,7 +6678,7 @@ printACLColumn(PQExpBuffer buf, const char *colname)
{ {
appendPQExpBuffer(buf, appendPQExpBuffer(buf,
"CASE" "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')" " ELSE pg_catalog.array_to_string(%s, E'\\n')"
" END AS \"%s\"", " END AS \"%s\"",
colname, gettext_noop("(none)"), colname, gettext_noop("(none)"),