Usability fail with psql's \dp command - Mailing list pgsql-hackers

I noticed today that \dp does not distinguish empty acl fields
(meaning nobody has any privileges) from null acl fields
(which mean default privileges, typically not empty).
For instance

regression=# \c joe joe
You are now connected to database "joe" as user "joe".
joe=> create table jt (f1 int);
CREATE TABLE
joe=> \dp
                            Access privileges
 Schema | Name | Type  | Access privileges | Column privileges | Policies 
--------+------+-------+-------------------+-------------------+----------
 public | jt   | table |                   |                   | 
(1 row)

joe=> insert into jt values(1);
INSERT 0 1
joe=> revoke all on table jt from joe;
REVOKE
joe=> \dp
                            Access privileges
 Schema | Name | Type  | Access privileges | Column privileges | Policies 
--------+------+-------+-------------------+-------------------+----------
 public | jt   | table |                   |                   | 
(1 row)

joe=> insert into jt values(1);
ERROR:  permission denied for table jt

So those are definitely different privilege states, but they look
the same.

One idea is to replace a null ACL value with the actual effective
permissions, which we could get from the acldefault() function.
However, acldefault() only exists since 9.2, and in any case
I'm afraid that might be perceived as mostly clutter.

What do people think of printing "Default" if the ACL is null?

Alternatively, since the state with an empty ACL is certainly
the unusual case, maybe we should mark that specially, perhaps
by printing "None" or "No privileges".

(I've not looked at the code to see how hard such changes would be.)

            regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Segfault logical replication PG 10.4
Next
From: David Fetter
Date:
Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options