From: | Pavel Luzanov <p(dot)luzanov(at)postgrespro(dot)ru> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, David Zhang <david(dot)zhang(at)highgo(dot)ca> |
Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: psql: Add role's membership options to the \du+ command |
Date: | 2023-02-17 11:02:01 |
Message-ID: | e587e2ee-7de0-88a2-10f8-c7cf001bab8c@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
> On the one hand, it would be nice to see the membership options with
> the psql command.
After playing with cf5eb37c and e5b8a4c0 I think something must be made
with \du command.
postgres(at)demo(16.0)=# CREATE ROLE admin LOGIN CREATEROLE;
CREATE ROLE
postgres(at)demo(16.0)=# \c - admin
You are now connected to database "demo" as user "admin".
admin(at)demo(16.0)=> SET createrole_self_grant = 'SET, INHERIT';
SET
admin(at)demo(16.0)=> CREATE ROLE bob LOGIN;
CREATE ROLE
admin(at)demo(16.0)=> \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
admin | Create role
| {bob,bob}
bob | | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS
| {}
We see two bob roles in the 'Member of' column.Strange? But this is correct.
admin(at)demo(16.0)=> select roleid::regrole, member::regrole, * from
pg_auth_members where roleid = 'bob'::regrole;
roleid | member | oid | roleid | member | grantor | admin_option |
inherit_option | set_option
--------+--------+-------+--------+--------+---------+--------------+----------------+------------
bob | admin | 16713 | 16712 | 16711 | 10 | t |
f | f
bob | admin | 16714 | 16712 | 16711 | 16711 | f |
t | t
(2 rows)
First 'grant bob to admin' command issued immediately after creating
role bob by superuser(grantor=10). Second command issues by admin role
and set membership options SET and INHERIT.
If we don't ready to display membership options with \du+ may be at
least we must group records in 'Member of' column for \du command?
-----
Pavel Luzanov
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2023-02-17 11:04:22 | Re: Support logical replication of DDLs |
Previous Message | Nazir Bilal Yavuz | 2023-02-17 10:53:36 | Re: Refactor calculations to use instr_time |