Skip to main content

SET ROLE

Switches the active role for a session, and the currently active role can be viewed using the SHOW ROLES command, with the is_current field indicating the active role. For more information about the active role and secondary roles, see Active Role & Secondary Roles.

See also: SET SECONDARY ROLES

Syntax

SET ROLE <role_name>

Examples

SHOW ROLES;

┌───────────────────────────────────────────────────────┐
│ name │ inherited_roles │ is_current │ is_default │
├───────────┼─────────────────┼────────────┼────────────┤
│ developer │ 0falsefalse
public0falsefalse
│ writer │ 0truetrue
└───────────────────────────────────────────────────────┘

SET ROLE developer;

SHOW ROLES;

┌───────────────────────────────────────────────────────┐
│ name │ inherited_roles │ is_current │ is_default │
├───────────┼─────────────────┼────────────┼────────────┤
│ developer │ 0truefalse
public0falsefalse
│ writer │ 0falsetrue
└───────────────────────────────────────────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today