SET SESSION AUTHORIZATION
Synopsis
Use the SET SESSION AUTHORIZATION
statement to set the current user and session user of the current session to be the specified user.
Syntax
set_session_authorization ::= SET [ SESSION | LOCAL ] SESSION
AUTHORIZATION { role_name | DEFAULT }
reset_session_authorization ::= RESET SESSION AUTHORIZATION
set_session_authorization
reset_session_authorization
Semantics
Session user can only be changed by superusers.Once the session user is set to role_name
, any further SQL commands will use the privileges available to that role.
To reset the session user back to current authenticated user, RESET SESSION AUTHORIZATION
or SET SESSION AUTHORIZATION DEFAULT
can be used.
Examples
- Set session user to John.
yugabyte=# select session_user, current_user;
session_user | current_user
--------------+--------------
yugabyte | yugabyte
(1 row)
yugabyte=# set session authorization john;
SET
yugabyte=# select session_user, current_user;
session_user | current_user
--------------+--------------
john | john
(1 row)
See also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .