Role grant consistency¶
MatrixOne checks role membership as a graph and rejects grants that would create a cycle, including grants submitted concurrently.
Syntax¶
GRANT granted_role TO receiving_role;
The GRANT syntax is unchanged. See GRANT for privileges and user targets.
Arguments¶
granted_roleis the existing role whose privileges are inherited.receiving_roleis the existing role that receives those privileges.A role may inherit another role, but a grant that would make a role inherit itself directly or indirectly is rejected. Concurrent role membership changes are checked against a consistent committed graph.
Examples¶
CREATE DATABASE docs_role_graph;
USE docs_role_graph;
DROP ROLE IF EXISTS docs_role_parent;
DROP ROLE IF EXISTS docs_role_child;
CREATE ROLE docs_role_parent;
CREATE ROLE docs_role_child;
GRANT docs_role_parent TO docs_role_child;
DROP ROLE docs_role_child;
DROP ROLE docs_role_parent;
DROP DATABASE docs_role_graph;
The example creates and removes one valid role edge. A reverse grant while that edge exists would form a cycle and be rejected.