From e22360433a0f2e1ddd0f258fb6e9a7c9678aa697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Mon, 8 Apr 2024 17:03:30 +0200 Subject: [PATCH] ebnf set role --- sql-statements/sql-statement-set-role.md | 25 ++++-------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/sql-statements/sql-statement-set-role.md b/sql-statements/sql-statement-set-role.md index 703b8e62db0a1..242677164cd0a 100644 --- a/sql-statements/sql-statement-set-role.md +++ b/sql-statements/sql-statement-set-role.md @@ -10,24 +10,15 @@ The `SET ROLE` statement is used to enable roles in the current session. After e ## Synopsis -**SetRoleStmt:** - -![SetRoleStmt](/media/sqlgram/SetRoleStmt.png) - -**SetRoleOpt:** - -![SetRoleOpt](/media/sqlgram/SetRoleOpt.png) - -**SetDefaultRoleOpt:** - -![SetDefaultRoleOpt](/media/sqlgram/SetDefaultRoleOpt.png) +```ebnf+diagram +SetRoleStmt ::= + "SET" "ROLE" ( "DEFAULT" | "ALL" ( "EXCEPT" Rolename ("," Rolename)* )? | "NONE" | Rolename ("," Rolename)* )? +``` ## Examples Create a user `'u1'@'%'` and three roles: `'r1'@'%'`, `'r2'@'%'` and `'r3'@'%'`. Grant these roles to `'u1'@'%'` and set `'r1'@'%'` as the default role of `'u1'@'%'`. -{{< copyable "sql" >}} - ```sql CREATE USER 'u1'@'%'; CREATE ROLE 'r1', 'r2', 'r3'; @@ -37,8 +28,6 @@ SET DEFAULT ROLE 'r1' TO 'u1'@'%'; Log in as `'u1'@'%'` and execute the following `SET ROLE` statement to enable all roles. -{{< copyable "sql" >}} - ```sql SET ROLE ALL; SELECT CURRENT_ROLE(); @@ -55,8 +44,6 @@ SELECT CURRENT_ROLE(); Execute the following `SET ROLE` statement to enable `'r2'` and `'r3'`. -{{< copyable "sql" >}} - ```sql SET ROLE 'r2', 'r3'; SELECT CURRENT_ROLE(); @@ -73,8 +60,6 @@ SELECT CURRENT_ROLE(); Execute the following `SET ROLE` statement to enable the default role(s). -{{< copyable "sql" >}} - ```sql SET ROLE DEFAULT; SELECT CURRENT_ROLE(); @@ -91,8 +76,6 @@ SELECT CURRENT_ROLE(); Execute the following `SET ROLE` statement to cancel all enabled role(s). -{{< copyable "sql" >}} - ```sql SET ROLE NONE; SELECT CURRENT_ROLE();