DBMS_SESSION v17

EDB Postgres Advanced Server provides support for the following DBMS_SESSION.SET_ROLE procedure:

Function/procedureReturn typeDescription
SET_ROLE(role_cmd)n/aExecutes a SET ROLE statement followed by the string value specified in role_cmd.

EDB Postgres Advanced Server's implementation of DBMS_SESSION is a partial implementation when compared to Oracle's version. Only DBMS_SESSION.SET_ROLE is supported.

SET_ROLE

The SET_ROLE procedure sets the current session user to the role specified in role_cmd. After invoking the SET_ROLE procedure, the current session uses the permissions assigned to the specified role. The signature of the procedure is:

SET_ROLE(<role_cmd>)

The SET_ROLE procedure appends the value specified for role_cmd to the SET ROLE statement and then invokes the statement.

Parameters

role_cmd

role_cmd specifies a role name in the form of a string value.

Example

This call to the SET_ROLE procedure invokes the SET ROLE command to set the identity of the current session user to manager:

edb=# exec DBMS_SESSION.SET_ROLE('manager');