SET SESSION AUTHORIZATION
Description
Sets the session user identifier and the current user identifier of the current session to the specified user.
Precautions
The session identifier can be changed only when the initial session user has the system administrator permissions. Otherwise, the system executes the command only when an authenticated username is specified.
Syntax
- Set the session user identifier and current user identifier for the current session.
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION role_name PASSWORD 'password';
- Reset the session and current user identifiers to the originally authenticated username.
{SET [ SESSION | LOCAL ] SESSION AUTHORIZATION DEFAULT | SET SESSION_AUTHORIZATION = DEFAULT};
Parameters
- SESSION
Specifies that the command takes effect only for the current session.
- LOCAL
Specifies that the command takes effect only for the current transaction.
- role_name
Specifies the username.
Value range: a string. For details about the username requirements, see •user_name.
- password
Specifies the password for the role. The password must comply with the password convention. Encrypted passwords are not supported.
- DEFAULT
Resets the identifiers of the session and current users to the initially authenticated usernames.
Examples
-- Create a role named paul. m_db=# CREATE ROLE paul IDENTIFIED BY '********'; -- Set the current user to paul. m_db=# SET SESSION AUTHORIZATION paul password '********'; Query the current user. m_db=# SELECT CURRENT_USER; -- Reset the current user. m_db=# SET SESSION_AUTHORIZATION = DEFAULT; -- Drop the user. m_db=# DROP USER paul;
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot