public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pavel Luzanov <[email protected]>
To: David G. Johnston <[email protected]>
To: David Zhang <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: psql: Add role's membership options to the \du+ command
Date: Fri, 17 Feb 2023 14:02:01 +0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<CAKFQuwYt3ENZoYgY2RBh-U4id_=vntT9uJ83PvxPSsPQ0Cc_Jw@mail.gmail.com>
	<[email protected]>
	<CAKFQuwbmAFfDw9ScCiOxK4UGf8Z8ny1nDgAn41gOJCeJ76QC4Q@mail.gmail.com>
	<[email protected]>

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@demo(16.0)=# CREATE ROLE admin LOGIN CREATEROLE;
CREATE ROLE
postgres@demo(16.0)=# \c - admin
You are now connected to database "demo" as user "admin".
admin@demo(16.0)=> SET createrole_self_grant = 'SET, INHERIT';
SET
admin@demo(16.0)=> CREATE ROLE bob LOGIN;
CREATE ROLE
admin@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@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


view thread (29+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: psql: Add role's membership options to the \du+ command
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox