After you create a role, you can grant the role to another role.
You can grant a role to any role other than itself. Circular role grant is not supported.
Prerequisites
To grant a role to another role, the current user must either hold the role being granted and have ADMIN OPTION on that role, or have the GRANT ANY ROLE privilege.
For information about how to view your privileges, see View user privileges. If you do not have the required privilege, contact the administrator to obtain the privilege. For more information about how to grant privileges to a user, see Grant direct privileges. For more information about how to view your roles, see View roles.
Syntax and examples
The SQL syntax is as follows:
GRANT role_name1 TO role_name2 [WITH ADMIN OPTION];
where:
role_name1specifies the name of the role to be granted to another role. When you grant multiple roles to a role at a time, separate role names with commas (,).You can grant a role to multiple roles at a time, or grant multiple roles to one or more roles at a time.
WITH ADMIN OPTIONmeans the grantee may pass the role on to others, and revoking the role from the grantee does not cascade to revoke it from those grantees.
For example, grant the role2 role to the role1 role:
obclient> GRANT role2 TO role1;
Query OK, 0 rows affected
For more information about the GRANT statement, see GRANT.
