Alter default privileges in postgres for other roles Let's say I have a role called user1, user2 and postgres.

Is it possible to alter the default privileges while logged in as postgres for objects created by user1 so that user2 can see them?

This is what I currently have, but this only works if I'm logged in as user1:

alter default privileges grant usage on schemas to user2;
alter default privileges grant select on tables to user2;
alter default privileges grant usage, select on sequences to user2;


Is it possible to get this to work while logged in as postgres?
To add default privileges for a different user, use the FOR ROLE clause:

ALTER DEFAULT PRIVILEGES FOR ROLE user1 ...

See the documentation for details.

As to the required permissions to run that statement, the documentation says:


  You can change default privileges only for objects that will be created by yourself or by roles that you are a member of.


That means that, unless you are a superuser, you can only use roles in FOR ROLE of which you are directly or indirectly a member.