Skip to content

SESSION_USER

Return the user who initiated the session.

SESSION_USER
% ybsql yellowbrick bobr -W
Password for user bobr: 
ybsql (6.1.0)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type:  \h for help with SQL commands
      \? for help with ybsql commands
      \g or terminate with semicolon to execute query
      \q to quit
yellowbrick=> select session_user;
 session_user 
--------------
 bobr
(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