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

Поиск
Список
Период
Сортировка
От Pavel Luzanov
Тема Re: Things I don't like about \du's "Attributes" column
Дата
Msg-id 9ce4e037-6611-4420-b480-f5669177a0cf@postgrespro.ru
обсуждение исходный текст
Ответ на Things I don't like about \du's "Attributes" column  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Things I don't like about \du's "Attributes" column  (Pavel Luzanov <p.luzanov@postgrespro.ru>)
Список pgsql-hackers
On 03.01.2024 02:37, Jim Nasby wrote:

Some attributes are arguably important enough to warrant their own column. The most obvious is NOLOGIN, since those roles are generally used for a very different purpose than LOGIN roles. SUPERUSER might be another candidate (though, I much prefer a dedicated "sudo role" than explicit SU on roles).

I like this idea.
But what if all the attributes are moved to separate columns?
This solves all issues except the wide output. Less significant attributes
can be moved to extended mode. Here's what it might look like:

postgres@postgres(17.0)=# \du                             List of roles Role name | Login | Superuser | Create role | Create DB | Replication 
-----------+-------+-----------+-------------+-----------+------------- admin     | no    | no        | no          | no        | no alice     | yes   | yes       | no          | no        | no bob       | yes   | no        | no          | yes       | yes charlie   | yes   | no        | yes         | no        | no postgres  | yes   | yes       | yes         | yes       | yes
(5 rows)

postgres@postgres(17.0)=# \du+                                                                                                     List of roles Role name | Login | Superuser | Create role | Create DB | Replication | Bypass RLS | Inheritance | Password |      Valid until       | Connection limit |                         Description                         
-----------+-------+-----------+-------------+-----------+-------------+------------+-------------+----------+------------------------+------------------+------------------------------------------------------------- admin     | no    | no        | no          | no        | no          | no         | yes         | no       |                        |               -1 | Group role without login alice     | yes   | yes       | no          | no        | no          | no         | no          | yes      | infinity               |                5 | Superuser but with connection limit and with no inheritance bob       | yes   | no        | no          | yes       | yes         | yes        | yes         | no       | 2022-01-01 00:00:00+03 |               -1 | No password but with expire time charlie   | yes   | no        | yes         | no        | no          | no         | yes         | yes      |                        |                0 | No connections allowed postgres  | yes   | yes       | yes         | yes       | yes         | yes        | yes         | yes      |                        |               -1 | 
(5 rows)

postgres@postgres(17.0)=# \x \du+ bob
Expanded display is on.
List of roles
-[ RECORD 1 ]----+---------------------------------
Role name        | bob
Login            | yes
Superuser        | no
Create role      | no
Create DB        | yes
Replication      | yes
Bypass RLS       | yes
Inheritance      | yes
Password         | no
Valid until      | 2022-01-01 00:00:00+03
Connection limit | -1
Description      | No password but with expire time
-- 
Pavel Luzanov
Postgres Professional: https://postgrespro.com
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Add BF member koel-like indentation checks to SanityCheck CI
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Adding a pg_get_owned_sequence function?