Setting roles
Use the SET ROLE command to assign a role to the users.
Procedure
- To set a role, run the
set role <name>;
command. - To set a role to none, run the
set role none;
command.Note: When you set a role, the current authorization switches to the role. If you set a role to none, the authorization is set back to the current user.When you create or modify any object after setting the role, the owner of that object will be always role.
Depending on how you set up the role, it can be recognized as either a database user or a group of database users.
Setting roles is session-based. When you set a role, the session has only those privileges which are granted to the role.