Enabling Roles

By default, roles aren't enabled automatically for a user account. (See Default Roles for Database Users for a way to make roles enabled automatically.) Users must explicitly enable a role using the SET ROLE statement. When users enable a role in their session, they gain all of the privileges assigned to that role. Enabling a role does not affect any other roles that the users have active in their sessions. They can have multiple roles enabled simultaneously, gaining the combined privileges of all the roles they have enabled, plus any of the privileges that have been granted to them directly.

=> SELECT * FROM applog;
ERROR:  permission denied for relation applog

=> SET ROLE logreader;
SET

=> SELECT * FROM applog;

 id | sourceID |            data            |                    event          
----+----------+----------------------------+----------------------------------------------
  1 | Loader   | 2011-03-31 11:00:38.494226 | Error: Failed to open source file
  2 | Reporter | 2011-03-31 11:00:38.494226 | Warning: Low disk space on volume /scratch-a
(2 rows)

You can enable all of the roles available to your user account using the SET ROLE ALL statement.

=> SET ROLE ALL;SET
=> SHOW ENABLED_ROLES;


     name      |           setting
---------------+------------------------------
 enabled roles | logreader, logwriter
(1 row)