Skip to content

SESSION_USER

Return the user who initiated the session.

SESSION_USER
premdb=# \c premdb yellowbrick
You are now connected to database "premdb" as user "yellowbrick".
premdb=# select session_user;
 session_user 
--------------
 yellowbrick
(1 row)

Typically, the session user is the user who opened the current database connection; however, superusers can change the session user by running the SET SESSION AUTHORIZATION command.

Parent topic:System Functions