diff --git a/src/backend/distributed/commands/role.c b/src/backend/distributed/commands/role.c index d0b33ccb9..20f21902e 100644 --- a/src/backend/distributed/commands/role.c +++ b/src/backend/distributed/commands/role.c @@ -1241,12 +1241,6 @@ PreprocessGrantRoleStmt(Node *node, const char *queryString, return NIL; } - /* - * Postgres don't seem to use the grantor. Even dropping the grantor doesn't - * seem to affect the membership. If this changes, we might need to add grantors - * to the dependency resolution too. For now we just don't propagate it. - */ - stmt->grantor = NULL; stmt->grantee_roles = distributedGranteeRoles; char *sql = DeparseTreeNode((Node *) stmt); stmt->grantee_roles = allGranteeRoles; diff --git a/src/backend/distributed/commands/utility_hook.c b/src/backend/distributed/commands/utility_hook.c index 68af4b7b5..a69480b45 100644 --- a/src/backend/distributed/commands/utility_hook.c +++ b/src/backend/distributed/commands/utility_hook.c @@ -170,6 +170,12 @@ citus_ProcessUtility(PlannedStmt *pstmt, Node *parsetree = pstmt->utilityStmt; + if (IsA(parsetree, GrantRoleStmt)) + { + GrantRoleStmt *grantRoleStmt = (GrantRoleStmt *) parsetree; + elog(LOG, "GrantRoleStmt: "); + } + if (IsA(parsetree, TransactionStmt)) { TransactionStmt *transactionStmt = (TransactionStmt *) parsetree; diff --git a/src/test/regress/expected/create_role_propagation.out b/src/test/regress/expected/create_role_propagation.out index 68291ea32..f8c866440 100644 --- a/src/test/regress/expected/create_role_propagation.out +++ b/src/test/regress/expected/create_role_propagation.out @@ -252,7 +252,7 @@ SELECT result FROM run_command_on_all_nodes( [{"member":"dist_role_4","role":"dist_role_3","grantor":"test_admin_role","admin_option":false}, + {"member":"non_dist_role_3","role":"dist_role_3","grantor":"test_admin_role","admin_option":false}, + {"member":"test_admin_role","role":"dist_role_3","grantor":"postgres","admin_option":true}] - [{"member":"dist_role_4","role":"dist_role_3","grantor":"postgres","admin_option":false}, + + [{"member":"dist_role_4","role":"dist_role_3","grantor":"test_admin_role","admin_option":false}, + {"member":"test_admin_role","role":"dist_role_3","grantor":"postgres","admin_option":true}] [{"member":"dist_role_4","role":"dist_role_3","grantor":"postgres","admin_option":false}, + {"member":"test_admin_role","role":"dist_role_3","grantor":"postgres","admin_option":true}] @@ -280,6 +280,7 @@ SELECT objid::regrole FROM pg_catalog.pg_dist_object WHERE classid='pg_authid':: (5 rows) REVOKE dist_role_3 from non_dist_role_3 granted by test_admin_role; +revoke dist_role_3 from test_admin_role cascade; drop role test_admin_role; \c - - - :worker_1_port SELECT roleid::regrole::text AS role, member::regrole::text, grantor::regrole::text, admin_option FROM pg_auth_members WHERE roleid::regrole::text LIKE '%dist\_%' ORDER BY 1, 2; diff --git a/src/test/regress/sql/create_role_propagation.sql b/src/test/regress/sql/create_role_propagation.sql index 0a5df2c7f..6bddb6e00 100644 --- a/src/test/regress/sql/create_role_propagation.sql +++ b/src/test/regress/sql/create_role_propagation.sql @@ -131,6 +131,8 @@ SELECT roleid::regrole::text AS role, member::regrole::text, (grantor::regrole:: SELECT objid::regrole FROM pg_catalog.pg_dist_object WHERE classid='pg_authid'::regclass::oid AND objid::regrole::text LIKE '%dist\_%' ORDER BY 1; REVOKE dist_role_3 from non_dist_role_3 granted by test_admin_role; + +revoke dist_role_3 from test_admin_role cascade; drop role test_admin_role; \c - - - :worker_1_port