Skip to main content
Verifies whether a role (or a nested role) is active in the current session. This function is supported from v3.1.4 onwards.

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

  1. Create roles and a user.
  2. Verify whether r1 is active. The result shows this role is not active.
  3. Run the SET ROLE command to activate r1 and use is_role_in_session to verify whether the role is active. The result shows r1 is active and roles r2 and r3 that are nested in r1 are also active.