current_role

A function returning the current user name

current_role is a system function returning the name of the current role under which statements will be executed.

current_role was added in PostgreSQL 8.1 as an SQL-compatible equivalent of current_user, although it was not documented until PostgreSQL 10.

Change history

Examples

Basic usage example for current_role:

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

Categories

System function, Users and roles

See also

current_user