Merge branch 'main' of https://github.com/ThomasC02/citus into feature/revoke-cascade-support

Added Support for CASCADE/RESTRICT in REVOKE statements updated testing
Issue #7105
pull/7958/head
ThomasC02 2025-04-24 13:05:40 -04:00
commit 1f28849d3d
4 changed files with 1474 additions and 314 deletions

View File

@ -182,6 +182,7 @@ PreprocessGrantStmt(Node *node, const char *queryString,
appendStringInfo(&ddlString, "REVOKE %s%s ON %s FROM %s",
grantOption, privsString.data, targetString.data,
granteesString.data);
<<<<<<< HEAD
if (grantStmt->behavior == DROP_CASCADE)
{
@ -192,7 +193,23 @@ PreprocessGrantStmt(Node *node, const char *queryString,
appendStringInfoString(&ddlString, " RESTRICT");
}
}
=======
>>>>>>> b233b0a2a6d590e6b2565eb8278aeec4e6021773
appendStringInfo(&ddlString, "REVOKE %s%s ON %s FROM %s",
grantOption, privsString.data, targetString.data,
granteesString.data);
if (grantStmt->behavior == DROP_CASCADE)
{
appendStringInfoString(&ddlString, " CASCADE");
}
else
{
appendStringInfoString(&ddlString, " RESTRICT");
}
}
DDLJob *ddlJob = palloc0(sizeof(DDLJob));
ObjectAddressSet(ddlJob->targetObjectAddress, RelationRelationId, relationId);
ddlJob->metadataSyncCommand = pstrdup(ddlString.data);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -424,8 +424,19 @@ SELECT id FROM grant_table_propagated_after;
:verify_grant_table ;
:verify_grant_attributes ;
-- cleanup
REVOKE SELECT (id) ON grant_table_propagated_after FROM grant_user_0;
-- cleanup and test revoke
SET citus.log_remote_commands TO on;
set citus.grep_remote_commands = '%REVOKE%';
REVOKE SELECT (id) ON grant_table_propagated_after FROM grant_user_0 CASCADE;
RESET citus.grep_remote_commands;
RESET citus.log_remote_commands;
-- cleanup and test revoke
SET citus.log_remote_commands TO on;
set citus.grep_remote_commands = '%REVOKE%';
REVOKE SELECT (id) ON grant_table_propagated_after FROM grant_user_0 RESTRICT;
RESET citus.grep_remote_commands;
RESET citus.log_remote_commands;
:verify_grant_table ;
:verify_grant_attributes ;