Postgresql: How to grant permission for set role?

Iuliia picture Iuliia · Oct 30, 2015 · Viewed 8k times · Source

There is user 'test_user1'. SET ROLE Command:

SET ROLE test_user1

returns error:

ERROR:  permission denied to set role "test_user2"

I couldn't find how to grant permission for SET ROLE.

Thanks in advance.

Answer

Egor Rogov picture Egor Rogov · Oct 30, 2015

Error message

ERROR: permission denied to set role "test_user2"

implies that the command was

test_user1> SET ROLE test_user2;

, but not SET ROLE test_user1 as you wrote.

If you are trying to set role test_user2 for the user test_user1, grant it:

test_user2> grant test_user2 to test_user1;