From: Rui DeSousa <rui@crazybean.net>
To: pavan95 <pavan.postgresdba@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: How to revoke "Create Privilege" from a readonly user in postgres?
Date: Wed, 7 Nov 2018 01:14:21 -0500
Message-ID: <2A936B5B-CF6A-41E5-B839-E6CE7EDB8CF7@crazybean.net> (raw)
In-Reply-To: <1541569945694-0.post@n3.nabble.com>
References: <1541419964128-0.post@n3.nabble.com>
<E3F51CC1-3549-460C-83D2-7C3E26B026C6@crazybean.net>
<1541569945694-0.post@n3.nabble.com>
> On Nov 7, 2018, at 12:52 AM, pavan95 <pavan.postgresdba@gmail.com> wrote:
>
> grant SELECT on all tables in schema readonly to readonly;
That grants select on all existing tables to readonly user; not future tables.
To auto grant select on future tables you have to change the default privileges.
I.e.
alter default privileges in schema readonly grant select on tables to readonly;
You can also scope it to only a user instead of anyone to creates a table in readonly schema. Then only when xxx creates a table in schema readonly will it auto grant the select.
alter default privileges for user xxx in schema readonly grant select on tables to readonly;
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-admin@postgresql.org
Cc: rui@crazybean.net, pavan.postgresdba@gmail.com
Subject: Re: How to revoke "Create Privilege" from a readonly user in postgres?
In-Reply-To: <2A936B5B-CF6A-41E5-B839-E6CE7EDB8CF7@crazybean.net>
References: <1541419964128-0.post@n3.nabble.com> <E3F51CC1-3549-460C-83D2-7C3E26B026C6@crazybean.net> <1541569945694-0.post@n3.nabble.com> <2A936B5B-CF6A-41E5-B839-E6CE7EDB8CF7@crazybean.net>
* 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