psql: Add role's membership options to the \du+ command
От | Pavel Luzanov |
---|---|
Тема | psql: Add role's membership options to the \du+ command |
Дата | |
Msg-id | b9be2d0e-a9bc-0a30-492f-a4f68e4f7740@postgrespro.ru обсуждение исходный текст |
Ответы |
Re: psql: Add role's membership options to the \du+ command
Re: psql: Add role's membership options to the \du+ command Re: psql: Add role's membership options to the \du+ command |
Список | pgsql-hackers |
When you include one role in another, you can specify three options: ADMIN, INHERIT (added in e3ce2de0) and SET (3d14e171). For example. CREATE ROLE alice LOGIN; GRANT pg_read_all_settings TO alice WITH ADMIN TRUE, INHERIT TRUE, SET TRUE; GRANT pg_stat_scan_tables TO alice WITH ADMIN FALSE, INHERIT FALSE, SET FALSE; GRANT pg_read_all_stats TO alice WITH ADMIN FALSE, INHERIT TRUE, SET FALSE; For information about the options, you need to look in the pg_auth_members: SELECT roleid::regrole, admin_option, inherit_option, set_option FROM pg_auth_members WHERE member = 'alice'::regrole; roleid | admin_option | inherit_option | set_option ----------------------+--------------+----------------+------------ pg_read_all_settings | t | t | t pg_stat_scan_tables | f | f | f pg_read_all_stats | f | t | f (3 rows) I think it would be useful to be able to get this information with a psql command like \du (and \dg). With proposed patch the \du command still only lists the roles of which alice is a member: \du alice List of roles Role name | Attributes | Member of -----------+------------+-------------------------------------------------------------- alice | | {pg_read_all_settings,pg_read_all_stats,pg_stat_scan_tables} But the \du+ command adds information about the selected ADMIN, INHERIT and SET options: \du+ alice List of roles Role name | Attributes | Member of | Description -----------+------------+-----------------------------------------------+------------- alice | | pg_read_all_settings WITH ADMIN, INHERIT, SET+| | | pg_read_all_stats WITH INHERIT +| | | pg_stat_scan_tables | One more change. The roles in the "Member of" column are sorted for both \du+ and \du for consistent output. Any comments are welcome. -- Pavel Luzanov Postgres Professional: https://postgrespro.com
Вложения
В списке pgsql-hackers по дате отправления: