I have a RDS postgres database that only uses the public schema.
I expect the webservice
user to get access to all newly created views. When I create a view using the master
user, I see all the grants as expected.
Here are the DEFAULT PRIVILEGES I have setup.
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLES TO webservice;
When the rormigration user creates a view in the public schema, I see it is owned by rormigration and none of the DEFAULT PRIVILEGES are present. I have to switch the owner to master and grant rights.
What can I do to fix this permission issues?
Best Answer
As the documentation says in https://www.postgresql.org/docs/11/sql-alterdefaultprivileges.html:
So the best option is to create a group, put
webservice
and the user that create the views in that group and then apply theALTER DEFAULT PRIVILEGES
.