Re: problem with read-only user
Tom Lane <[email protected]> Fri, 20 Dec 2019 09:04:57 -0500
| Newsgroups | gmane.comp.db.postgresql.sql,gmane.comp.db.postgresql.devel.general |
|---|---|
| Message-ID | <[email protected]> |
ROS Didier <[email protected]> writes: > I created a read-only role as follows: > psql -p 5434 kidsdpn03 > CREATE ROLE kidsdpn03_ro PASSWORD 'xxx'; > ALTER ROLE kidsdpn03_ro WITH LOGIN; > GRANT CONNECT ON DATABASE kidsdpn03 TO kidsdpn03_ro; > GRANT USAGE ON SCHEMA kidsdpn03 TO kidsdpn03_ro; > GRANT SELECT ON ALL TABLES IN SCHEMA kidsdpn03 TO kidsdpn03_ro; > GRANT SELECT ON ALL SEQUENCES IN SCHEMA kidsdpn03 TO kidsdpn03_ro; > ALTER DEFAULT PRIVILEGES IN SCHEMA kidsdpn03 GRANT SELECT ON TABLES TO k= idsdpn03_ro; > ALTER ROLE kidsdpn03_ro SET search_path TO kidsdpn03; > but when i create new tables, i don't have read access to those new tab= les. = You only showed us part of what you did ... but IIRC, = ALTER DEFAULT PRIVILEGES only affects privileges for objects subsequently made by the same user that issued the command. (Otherwise it'd be a security issue.) So maybe you didn't make the tables as the same user? regards, tom lane