top of page
MySQL:
CURRENT_ROLE
CURRENT_ROLE()
Returns a utf8 string containing the current active roles for the
current session, separated by commas, or NONE if there are none. The
value reflects the setting of the sql_quote_show_create system
variable.
URL: https://dev.mysql.com/doc/refman/8.0/en/information-functions.html
Example
GRANT 'r1', 'r2' TO 'u1'@'localhost';
SET DEFAULT ROLE ALL TO 'u1'@'localhost';
mysql> SELECT CURRENT_ROLE();
+-------------------+
| CURRENT_ROLE() |
+-------------------+
| `r1`@`%`,`r2`@`%` |
+-------------------+
mysql> SET ROLE 'r1'; SELECT CURRENT_ROLE();
+----------------+
| CURRENT_ROLE() |
+----------------+
| `r1`@`%` |
+----------------+
bottom of page