Re: GRANT SELECT ON ALL TABLES IN SCHEMA... doesn't apply to new tables?

From: Christopher Swingley <cswingle(at)swingleydev(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: GRANT SELECT ON ALL TABLES IN SCHEMA... doesn't apply to new tables?
Date: 2018-12-15 02:21:40
Message-ID: CAHsw449_9f4CP-Ggeh4B9OFNoqKR6sO4bbF=L==2n2GBVE2KZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Larry,

On Fri, Dec 14, 2018 at 17:14 Larry Rosenman <ler(at)lerctr(dot)org> wrote:

> I have the following grant in effect:
> GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly;
>
> We occasionally add tables to that schema, but the readonly role
> can't read them.

What you want is to apply default privileges to the roles that will be
creating new objects:

https://www.postgresql.org/docs/current/sql-alterdefaultprivileges.html

Your existing GRANT will take care of the tables you have, default
privileges will set permissions on new tables. \ddp shows the in psql.

Cheers,

Chris

--
Christopher Swingley
Fairbanks, Alaska
http://swingleydev.com/
cswingle(at)swingleydev(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargent 2018-12-15 02:50:09 Re: GRANT SELECT ON ALL TABLES IN SCHEMA... doesn't apply to new tables?
Previous Message Larry Rosenman 2018-12-15 02:13:59 GRANT SELECT ON ALL TABLES IN SCHEMA... doesn't apply to new tables?