Re: List user who have access to schema

2018-08-03 Thread pinker
I think this one will give you report you need: select schema_name, roleid::regrole, string_agg(member::regrole::text,',' order by member::regrole::text) users from information_schema.schemata s, pg_user u JOIN pg_auth_members a ON u.usename::text=a.roleid::regrole::text WHERE s.schema_name not

Re: List user who have access to schema

2018-08-02 Thread Adrian Klaver
On 08/02/2018 11:23 AM, Suresh Raja wrote: yes ... how can i pass variable * to the function has_schema_privilege(*, 'schema-of-interest', 'usage'); PREPARE schema_user(varchar, varchar) AS SELECT * FROM pg_user WHERE has_schema_privilege($1, $2, 'create'); EXECUTE schema_user ('aklaver',

Re: List user who have access to schema

2018-08-02 Thread Suresh Raja
yes ... how can i pass variable * to the function has_schema_privilege(*, 'schema-of-interest', 'usage'); Thanks! On Thu, Aug 2, 2018 at 12:58 PM, Tom Lane wrote: > Suresh Raja writes: > > I'm looking for query which can list all users who have access to a > > particular schema. > >

Re: List user who have access to schema

2018-08-02 Thread Tom Lane
Suresh Raja writes: > I'm looking for query which can list all users who have access to a > particular schema. Something involving SELECT ... FROM pg_user WHERE has_schema_privilege(usename, 'schema-of-interest', 'usage'); would probably be what you want. regards,

List user who have access to schema

2018-08-02 Thread Suresh Raja
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