PostgreSQL current_role

PostgreSQL current_role returns the name of the current user (the user of the current execution context).

The current_role is equivalent to current_user().

current_role Syntax

Here is the syntax of the PostgreSQL current_role function:

current_role -> name

Parameters

PostgreSQL current_role does not require any parameters.

Return value

PostgreSQL current_role returns the name of the current user (the user of the current execution context).

current_role Examples

To get the user of the current execution context, use the SELECT statement with current_role:

SELECT current_role;
 current_role
--------------
 postgres