From: Tom Lane <tgl@sss.pgh.pa.us>
To: sekhar chandra <sekharclouddbengineer@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Fwd: not able to give usage access to public schema
Date: Sat, 13 Jun 2020 22:15:56 -0400
Message-ID: <989793.1592100956@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7a7NbTVESHYw9urwDk0pnzms=wJUcR-0uCWCO0NCd+gAkBTA@mail.gmail.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>
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
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
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: tgl@sss.pgh.pa.us, sekharclouddbengineer@gmail.com, adrian.klaver@aklaver.com
Subject: Re: Fwd: not able to give usage access to public schema
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>
* 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