top of page
CerebroSQL

PostgreSQL:  

SET ROLE

SET [ SESSION | LOCAL ] ROLE rolename
SET [ SESSION | LOCAL ] ROLE NONE
RESET ROLE

Example

SELECT SESSION_USER, CURRENT_USER;

session_user | current_user
--------------+--------------
peter | peter

SET ROLE 'paul';

SELECT SESSION_USER, CURRENT_USER;

session_user | current_user
--------------+--------------
peter | paul

bottom of page