CURRENT_ROLE

2025-11-19 10:08:12  Updated

Syntax

CURRENT_ROLE()

Purpose

CURRENT_ROLE() returns the active roles of the current user in the current session. If the query result is NONE, none of the roles of the current user are active. Only the privileges of an active role can be used.

Examples

obclient [(none)]> SELECT CURRENT_ROLE();

The return result is as follows:

+-----------------------------+
| CURRENT_ROLE()              |
+-----------------------------+
| `role002`@`%`,`role001`@`%` |
+-----------------------------+
1 row in set

Contact Us