📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

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 │ │ public │ 0falsefalse │ │ writer │ 0truetrue │ └───────────────────────────────────────────────────────┘ SET ROLE developer; SHOW ROLES; ┌───────────────────────────────────────────────────────┐ │ name │ inherited_roles │ is_current │ is_default │ ├───────────┼─────────────────┼────────────┼────────────┤ │ developer │ 0truefalse │ │ public │ 0falsefalse │ │ writer │ 0falsetrue │ └───────────────────────────────────────────────────────┘

Was this page helpful?