Syntax
Parameters
role_name: the role you want to verify (can also be a nested role). Supported data type is VARCHAR.
Return value
Returns a BOOLEAN value.1 indicates the role is active in the current session. 0 indicates the opposite.
Examples
-
Create roles and a user.
-
Verify whether
r1is active. The result shows this role is not active. -
Run the SET ROLE command to activate
r1and useis_role_in_sessionto verify whether the role is active. The result showsr1is active and rolesr2andr3that are nested inr1are also active.