Improve default and empty privilege outputs in psql.
Default privileges are represented as NULL::aclitem[] in catalog ACL
columns, while revoking all privileges leaves an empty aclitem[].
These two cases used to produce identical output in psql meta-commands
like \dp. Using something like "\pset null '(default)'" as a
workaround for spotting the difference did not work, because null
values were always displayed as empty strings by describe.c's
meta-commands.
This patch improves that with two changes:
1. Print "(none)" for empty privileges so that the user is able to
distinguish them from default privileges, even without special
workarounds.
2. Remove the special handling of null values in describe.c,
so that "\pset null" is honored like everywhere else.
(This affects all output from these commands, not only ACLs.)
The privileges shown by \dconfig+ and \ddp as well as the column
privileges shown by \dp are not affected by change #1, because the
respective aclitem[] is reset to NULL or deleted from the catalog
instead of leaving an empty array.
Erik Wienhold and Laurenz Albe
Discussion: https://postgr.es/m/1966228777.127452.1694979110595@office.mailbox.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d1379ebf4c2d3d399e739966dbfa34e92a53b727
Modified Files
--------------
doc/src/sgml/ddl.sgml | 16 ++++++++++-
src/bin/psql/describe.c | 57 +++++++++-----------------------------
src/test/regress/expected/psql.out | 55 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/psql.sql | 32 +++++++++++++++++++++
4 files changed, 115 insertions(+), 45 deletions(-)