pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: sekhar chandra <sekharclouddbengineer@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Fwd: not able to give usage access to public schema
Date: Sat, 13 Jun 2020 19:28:24 -0700
Message-ID: <9b76e12f-8f78-4c67-1fbf-8bac20467293@aklaver.com> (raw)
In-Reply-To: <989793.1592100956@sss.pgh.pa.us>
References: <CAB7a7NamePJDb2EXp+WogHxw3GoVFN62TsbnnYP9tYZrHgmYgg@mail.gmail.com>
	<CAB7a7NaYcD9U+uWrMni7zstsQJSf2e9KKcyp5pzHSwuz4BbtMw@mail.gmail.com>
	<cd84bab4-0cc3-9c0a-64cf-e23cc6cf62a6@aklaver.com>
	<CAB7a7NbTVESHYw9urwDk0pnzms=wJUcR-0uCWCO0NCd+gAkBTA@mail.gmail.com>
	<989793.1592100956@sss.pgh.pa.us>

On 6/13/20 7:15 PM, Tom Lane wrote:
> sekhar chandra <sekharclouddbengineer@gmail.com> writes:
>> Adrian - when I follow the same steps what you did . in my case , the
>> result is false.
> 
>> grant usage on schema public to role_test ;
>> GRANT
> 
>> SELECT rolname, has_schema_privilege('role_test', 'public', 'usage')
>> from pg_roles where rolname = 'role_test';
>>     rolname  | has_schema_privilege
>> -----------+----------------------
>>    role_test | f
> 
> This is verging on impossible to believe.  To start with, in a standard

I'm wrestling with the same thing. What also is in the file that Sekhar 
sent was the fact this is happening in an AWS Aurora instance. I've gone 
over the Aurora docs and can't see anything that says the behavior is 
different. Still it is another data point.

> installation rights on the public schema are granted to PUBLIC, so that
> any role should *already* have usage privilege as soon as it's created.
> Thus:
> 
> regression=# create user role_test;
> CREATE ROLE
> regression=# select has_schema_privilege('role_test', 'public', 'usage');
>   has_schema_privilege
> ----------------------
>   t
> (1 row)
> 
> Even if you'd revoked that public grant, manually granting should
> certainly have worked.  So my thoughts are running towards maybe
> you have created a nonstandard version of has_schema_privilege()
> that doesn't do what you think.
> 
> Anyway, I'd suggest removing some variables from the equation by
> looking directly at the catalog:
> 
> postgres=# table pg_namespace;
>    oid  |      nspname       | nspowner |               nspacl
> -------+--------------------+----------+-------------------------------------
> ...
>    2200 | public             |       10 | {postgres=UC/postgres,=UC/postgres}
> ...
> 
> That's what I get in a default installation.  If I manually GRANT, it
> changes to
> 
>     2200 | public            |       10 | {postgres=UC/postgres,=UC/postgres,role_test=U/postgres}
> 
> What do you see?
> 
> 			regards, tom lane
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (7+ messages)

Message-ID: <9b76e12f-8f78-4c67-1fbf-8bac20467293@aklaver.com>
Permalink:  ../9b76e12f-8f78-4c67-1fbf-8bac20467293@aklaver.com/
Also on:    postgresql.org/message-id/9b76e12f-8f78-4c67-1fbf-8bac20467293@aklaver.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, tgl@sss.pgh.pa.us, sekharclouddbengineer@gmail.com
  Subject: Re: Fwd: not able to give usage access to public schema
  In-Reply-To: <9b76e12f-8f78-4c67-1fbf-8bac20467293@aklaver.com>
  References: <CAB7a7NamePJDb2EXp+WogHxw3GoVFN62TsbnnYP9tYZrHgmYgg@mail.gmail.com> <CAB7a7NaYcD9U+uWrMni7zstsQJSf2e9KKcyp5pzHSwuz4BbtMw@mail.gmail.com> <cd84bab4-0cc3-9c0a-64cf-e23cc6cf62a6@aklaver.com> <CAB7a7NbTVESHYw9urwDk0pnzms=wJUcR-0uCWCO0NCd+gAkBTA@mail.gmail.com> <989793.1592100956@sss.pgh.pa.us> <9b76e12f-8f78-4c67-1fbf-8bac20467293@aklaver.com>

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

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