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

Christopher Swingley <[email protected]> Fri, 14 Dec 2018 17:21:40 -0900
Newsgroups gmane.comp.db.postgresql.sql
Message-ID <CAHsw449_9f4CP-Ggeh4B9OFNoqKR6sO4bbF=L==2n2GBVE2KZA@mail.gmail.com>
Larry,

On Fri, Dec 14, 2018 at 17:14 Larry Rosenman <[email protected]> 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/
[email protected]