Re: List user who have access to schema

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: List user who have access to schema
Date: 2018-08-02 18:47:25
Message-ID: 979bea7a-9b98-f702-4468-e0f3b7d9c37f@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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', 'public');

DEALLOCATE schema_user ;

>
> Thanks!
>
> On Thu, Aug 2, 2018 at 12:58 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>> wrote:
>
> Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com
> <mailto:suresh(dot)rajaabc(at)gmail(dot)com>> 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, tom lane
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2018-08-02 20:00:16 Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function
Previous Message David G. Johnston 2018-08-02 18:42:12 Re: List user who have access to schema

Browse pgsql-sql by date

  From Date Subject
Next Message pinker 2018-08-03 14:26:25 Re: List user who have access to schema
Previous Message David G. Johnston 2018-08-02 18:42:12 Re: List user who have access to schema