PostgreSQL SESSION_USER Function
The PostgreSQL SESSION_USER function returns user name for the current PostgreSQL session.
Syntax
SESSION_USER
Note: Do not put parentheses () after the SESSION_USER function.
Return Value
Returns the session user name.
Example:
The example below shows the usage of SESSION_USER function.
SELECT SESSION_USER;
The above query will return the user name for the current PostgreSQL session. Therefore if the user name for the current PostgreSQL session is 'root', it will return the following:
SELECT SESSION_USER; Result: 'root'
❮ PostgreSQL Functions