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.

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
└───────────────────────────────────────────────────────┘
Did this page help you?
Yes
No
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today