Re: Things I don't like about \du's "Attributes" column

Pavel Luzanov <p.luzanov@postgrespro.ru>

From: Pavel Luzanov <p.luzanov@postgrespro.ru>
To: Rafia Sabih <rafia.pghackers@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, "David G. Johnston" <david.g.johnston@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Jim Nasby <jim.nasby@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-07-13T12:21:05Z
Lists: pgsql-hackers
On 12.07.2024 12:22, Rafia Sabih wrote:
> Other thoughts came to my mind, should we have this column in \du+
> instead, maybe connection limit too.
> I know in the current version we have all this in \du itself, but then
> all clubbed in one column. But now since
> our table has got wider, it might be aesthetic to have it in the
> extended version. Also, their usage wise might not
> be the first thing to be looked at for a user/role.

In the first version of the patch, "Valid until" (named "Password expire time")
and "Connection limit" ("Max connections") columns were in extended mode. [1]

Later we decided to place each attribute in the "Attributes" column on a separate
line. This allowed us to significantly reduce the overall width of the output.
So, I decided to move "Valid until" and "Connection limit" from extended mode
to normal mode.

Just compare output from patched \du and popular \list command:

postgres@demo(17.0)=# \du
                                 List of roles
  Role name | Login | Attributes  |      Valid until       | Connection limit
-----------+-------+-------------+------------------------+------------------
  alice     | yes   | Inherit     | 2024-06-30 00:00:00+03 |
  bob       | yes   | Inherit     | infinity               |
  charlie   | yes   | Inherit     |                        |               11
  postgres  | yes   | Superuser  +|                        |
            |       | Create DB  +|                        |
            |       | Create role+|                        |
            |       | Inherit    +|                        |
            |       | Replication+|                        |
            |       | Bypass RLS  |                        |
(4 rows)

postgres@demo(17.0)=# \list
                                                      List of databases
    Name    |  Owner   | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | ICU Rules |   Access privileges
-----------+----------+----------+-----------------+-------------+-------------+--------+-----------+-----------------------
  demo      | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |           |
  postgres  | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |           |
  template0 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |           | =c/postgres          +
            |          |          |                 |             |             |        |           | postgres=CTc/postgres
  template1 | postgres | UTF8     | libc            | en_US.UTF-8 | en_US.UTF-8 |        |           | =c/postgres          +
            |          |          |                 |             |             |        |           | postgres=CTc/postgres
(4 rows)

If we decide to move "Valid until" and "Connection limit" to extended mode,
then the role attributes should be returned to their previous form by placing
them on one line separated by commas.

1.https://www.postgresql.org/message-id/27f87cb9-229b-478b-81b2-157f94239d55%40postgrespro.ru

-- 
Pavel Luzanov
Postgres Professional:https://postgrespro.com