Re: psql: \dl+ to list large objects privileges

From: Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru>
To: gkokolatos(at)pm(dot)me, Pavel Luzanov <pluzanov(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql: \dl+ to list large objects privileges
Date: 2021-09-06 14:10:51
Message-ID: c36cc318-b3a6-600b-9291-9054b9aa8f38@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 06.09.2021 14:39, gkokolatos(at)pm(dot)me wrote:

> I apply patches by `git apply` and executing the command on the latest version
> of your patch, produces:
>
> $ git apply lo-list-acl-v2.patch
> lo-list-acl-v2.patch:349: new blank line at EOF.
> +
> warning: 1 line adds whitespace errors

Thanks, this is what I was looking for. The patch command doesn't show these warnings
(or I don't know the right way for use it).

> I did spend a bit of time considering the addition of the verbose version of
> the command. I understand your reasoning explained upstream in the same thread.
> However, I am not entirely convinced. The columns in consideration are,
> "Description" and "Access Privileges". Within the describe commands there are
> four different options, listed and explained bellow:
>
> commands where description is found in verbose
> \d \dA \dc \dd \des \df \dFd \dFt \di \dL \dn \dO \dP \dPt \dt \du \dx \dy \da
> \db \dC \dD \det \dew \dFp \dg \dl \dm \do \dPi \dS \dT
>
> commands where description is not found in verbose (including object
> description)
> \dd \dFd \dFt \dL \dx \da \dF \dFp \dl \do \dT
>
> commands where access privileges is found in verbose
> \def \dD \des
>
> commands where access privileges is not found in verbose (including access
> privilege describing)
> \ddp \dp \des \df \dL \dn \db \dD \dew \dl \dT
>
> With the above list, I would argue that it feels more natural to include
> the "Access Privileges" column in the non verbose version and be done with
> the verbose version all together.

My thoughts.
For most object types, the Description column is shown only in the verbose
version of the commands. But there are several object types,
including Large Objects, for which the description is shown in the normal version.
Both are valid options, so the Description column for large objects stays
in the normal version of the command.

Regarding the display of access privileges.
Instances of object types for which you can manage the access privileges
are listed in Table 5.2 [1].

For clarity, I will only show the first and last columns:

Table 5.2. Summary of Access Privileges

Object Type psql Command
------------------------------ ------------
DATABASE \l
DOMAIN \dD+
FUNCTION or PROCEDURE \df+
FOREIGN DATA WRAPPER \dew+
FOREIGN SERVER \des+
LANGUAGE \dL+
LARGE OBJECT
SCHEMA \dn+
SEQUENCE \dp
TABLE (and table-like objects) \dp
Table column \dp
TABLESPACE \db+
TYPE \dT+

By the way, after seeing an empty cell for Large Objects in this table,
I decided to make a patch.

Note that the \dp command is specially designed to display access privileges,
so you don't need to pay attention to the lack of a + sign for it.

It turns out that all commands use the verbose version (or special command)
to display access privileges. Except the \l command for the databases.

Now the question.
Should we add a second exception and display access privileges
for large objects with the \dl command or do the verbose version
like most other commands: \dl+
?

If you still think that there is no need for a verbose version,
I will drop it and add an 'Access privileges' column to the normal command.

[1] https://www.postgresql.org/docs/devel/ddl-priv.html#PRIVILEGES-SUMMARY-TABLE

Pavel Luzanov
Postgres Professional: https://postgrespro.com
The Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2021-09-06 14:13:35 Correct handling of blank/commented lines in PSQL interactive-mode history
Previous Message Thomas Munro 2021-09-06 13:04:46 Re: stat() vs ERROR_DELETE_PENDING, round N + 1