I want all developers to be able to work with each other's code. When one person creates a table, others should be able to query it directly without permissions needing to be granted.
I thought the way to accomplish this was to create a role role_developers
, have all developers be members of that role, and then do this:
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO role_developer;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO role_developer;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON FUNCTIONS TO role_developer;
My expectation is that setting those default privileges as above means that every new instance of such objects in the public schema will be assigned those privileges to everyone who's a member of that role.
However, even after doing this (logged in as my personal user account, which is also a member of role_developer
), I'm finding that after I create a new table, my colleagues aren't able to SELECT
from it.
So obviously I'm missing something. I'm new to pgsql although I'm an experienced SQL Server developer, which is obviously clouding my perspective.