CURRENT_ROLE

2025-11-14 07:33:32  Updated

Syntax

CURRENT_ROLE()

Purpose

CURRENT_ROLE() returns the active roles of the current user in the current session. If NONE is returned, it indicates that the current user does not have any active roles. A user can use only privileges of its active roles.

Examples

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

The return result is as follows:

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

Contact Us