List user who have access to schema

From: Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: List user who have access to schema
Date: 2018-08-02 17:49:00
Message-ID: CAJP7dtAWGcS9qHFWnFZhyunheGHVnWU-3O=GetD9DNdpSCHqZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hi All:

I'm looking for query which can list all users who have access to a
particular schema.
The user may be granted role, which is turn may have access to the schema.
If the schema name is sch1,

grant select on table sch1.tab1 to role_ro;
grant ALL on table sch1.tab1 to role_rw;

grant role_ro to user1;
grant role_rw to user2;

I'm looking for report like

Schema | Role | Username
------------------------------------------------------------------------
sch1 role_ro user1, user3
role_rw user2, user4

Thanks in advance,
-SR

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-08-02 17:58:37 Re: List user who have access to schema
Previous Message rihad 2018-08-02 14:08:49 Re: ERROR: found xmin 54230249 from before relfrozenxid 61349053

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2018-08-02 17:58:37 Re: List user who have access to schema
Previous Message Andreas Kretschmer 2018-07-27 11:38:58 Re: Regarding vacuumdb