SET SESSION AUTHORIZATION
Description
Sets the session user identifier and the current user identifier of the current session to a specified user.
Precautions
The session identifier can be changed only when the initial session user has the system administrator rights. Otherwise, the system supports the statement only when the authenticated username is specified.
Syntax
- Set the session user identifier and the current user identifier of the current session.
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION role_name PASSWORD 'password';
- Reset the identifiers of the session and current users to the initially authenticated usernames.
{SET [ SESSION | LOCAL ] SESSION AUTHORIZATION DEFAULT | RESET SESSION AUTHORIZATION};
Parameters
- SESSION
Specifies that the specified parameters take effect for the current session.
- LOCAL
Specifies that the specified statement takes effect only for the current transaction.
- role_name
Username.
Value range: a string. It must comply with the naming convention.
- password
Specifies the password of a role. It must comply with the password convention.
The restrictions on using a ciphertext password are as follows:
- An administrator cannot use a ciphertext password to switch to another administrator but to a user with lower permissions.
Ciphertext passwords are usually used in gs_dump and gs_dumpall export scenarios. In other scenarios, you are advised not to use ciphertext passwords directly.
- DEFAULT
Resets the identifiers of the session and current users to the initially authenticated usernames.
Examples
-- Create a role paul. gaussdb=# CREATE ROLE paul IDENTIFIED BY '********'; -- Set the current user to paul. gaussdb=# SET SESSION AUTHORIZATION paul password '********'; -- View the current session user and the current user. gaussdb=> SELECT SESSION_USER, CURRENT_USER; -- Reset the current user. gaussdb=> RESET SESSION AUTHORIZATION; -- Delete the user. gaussdb=# DROP USER paul;
Reference
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