SET ROLE

An SQL command for setting the session role

SET ROLE is a utility command for setting the session role.

SET ROLE was added in PostgreSQL 8.1.

Change history

Examples

Basic usage example for :

postgres=# SELECT current_user;
 current_user 
--------------
 postgres
(1 row)

postgres=# SET ROLE foo;
SET

postgres=> SELECT current_user;
 current_user 
--------------
 foo
(1 row)

Categories

Users and roles, Utility command

See also

RESET ROLE, SET SESSION AUTHORIZATION