Usability fail with psql's \dp command

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Usability fail with psql's \dp command
Date: 2018-07-28 18:41:24
Message-ID: 9705.1532803284@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2018-07-28 18:59:58 Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Previous Message Alvaro Herrera 2018-07-28 17:52:12 Re: Segfault logical replication PG 10.4