Re: Fix output of zero privileges in psql - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Fix output of zero privileges in psql
Date
Msg-id CAKFQuwYjAksEqN5AqLULDhNJAnX0WxRGXCVn8tE832+KK7qK4Q@mail.gmail.com
Whole thread Raw
In response to Re: Fix output of zero privileges in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fix output of zero privileges in psql  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-hackers
On Mon, Oct 23, 2023 at 7:57 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: 

IOW, the current definition is "NULL privileges print as an empty
string no matter what", and I don't think that serves to reduce
confusion about whether an ACL is NULL or not.  We ought to be doing
what we can to make clear that such an ACL *is* NULL, because
otherwise people won't understand how it differs from an empty ACL.


I tend to prefer the argument that these views are for human consumption and should be designed with that in mind.  Allowing the user to decide whether they prefer NULL to print as the empty string or something else works within that framework.  And the change of behavior for everyone with a non-default \pset gets accepted under that framework as well.

I would suggest that we make the expected presence of NULL as an input explicit:

case when spcacl is null then null
         when cardinality(spcacl) = 0 then '(none)' -- so as not to confuse it with null being printed also as an empty string
         else array_to_string(spcacl, E'\\n')
end as "Access privileges"

I would offer up:

when spcacl is null then '(default)'

along with not translating (none) and (default) and thus making the data contents of these views environment independent.  But minimizing the variance of these command's output across systems doesn't seem like a design goal that is likely to gain consensus and is excessive when viewed within the framework of these being only for human consumption.

David J.

pgsql-hackers by date:

Previous
From: Mark Wong
Date:
Subject: Re: LLVM 16 (opaque pointers)
Next
From: Robert Haas
Date:
Subject: Re: trying again to get incremental backup