Re: Fix output of zero privileges in psql

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Fix output of zero privileges in psql
Дата
Msg-id CAKFQuwYjAksEqN5AqLULDhNJAnX0WxRGXCVn8tE832+KK7qK4Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fix output of zero privileges in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Fix output of zero privileges in psql  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список 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 по дате отправления:

Предыдущее
От: Mark Wong
Дата:
Сообщение: Re: LLVM 16 (opaque pointers)
Следующее
От: Robert Haas
Дата:
Сообщение: Re: trying again to get incremental backup