PostgreSQL CURRENT_USER Function
The PostgreSQL CURRENT_USER function returns the user name for the current PostgreSQL user. The user name is the name of the user specified when connecting to the PostgreSQL database.
The USER function is a synonym for the CURRENT_USER function.
Syntax
CURRENT_USER
Note: Do not put parentheses () after the CURRENT_USER function.
Return Value
Returns the user name for the current PostgreSQL user.
Example:
The example below shows the usage of CURRENT_USER function.
SELECT CURRENT_USER;
The above query will return the user name for the current PostgreSQL user. Therefore if the user name specified when connecting to the server was 'root', it will return the following:
SELECT CURRENT_USER; Result: 'root'
❮ PostgreSQL Functions