diff --git a/src/backend/distributed/commands/distribute_object_ops.c b/src/backend/distributed/commands/distribute_object_ops.c index 08ae7c26a..f6d0b406a 100644 --- a/src/backend/distributed/commands/distribute_object_ops.c +++ b/src/backend/distributed/commands/distribute_object_ops.c @@ -2074,6 +2074,7 @@ GetDistributeObjectOps(Node *node) { return &Database_Grant; } + #if PG_VERSION_NUM >= PG_VERSION_15 case OBJECT_PARAMETER_ACL: { diff --git a/src/backend/distributed/commands/parameter.c b/src/backend/distributed/commands/parameter.c index 5f2d4cb9b..65c806c43 100644 --- a/src/backend/distributed/commands/parameter.c +++ b/src/backend/distributed/commands/parameter.c @@ -68,10 +68,11 @@ GenerateGrantOnParameterFromAclItem(char *parameterName, AclItem *aclItem) return queries; } + /* * CheckAndAppendQuery checks if the aclItem has the given mode and if it has, it appends the * corresponding query to the queries list. -*/ + */ static void CheckAndAppendQuery(List **queries, AclItem *aclItem, Oid granteeOid, char *parameterName, AclMode mode, char *modeStr) @@ -92,10 +93,11 @@ CheckAndAppendQuery(List **queries, AclItem *aclItem, Oid granteeOid, char *para } } + /* -* CheckPermissionsAndGrants checks if the aclItem has the valid permissions and grants -* for the given modes. -*/ + * CheckPermissionsAndGrants checks if the aclItem has the valid permissions and grants + * for the given modes. + */ static void CheckPermissionsAndGrants(AclItem *aclItem, AclMode modes[], int numModes) { @@ -105,7 +107,8 @@ CheckPermissionsAndGrants(AclItem *aclItem, AclMode modes[], int numModes) for (int i = 0; i < numModes; i++) { AclMode mode = modes[i]; - if(!(grants & mode) || (permissions & mode)){ + if (!(grants & mode) || (permissions & mode)) + { ereport(ERROR, (errmsg("ACL item has no grant option for mode %lu", mode))); } } @@ -166,4 +169,6 @@ GrantOnParameters(void) return commands; } + + #endif /* PG_VERSION_NUM >= PG_VERSION_15 */ diff --git a/src/backend/distributed/deparser/deparse_parameter_stmts.c b/src/backend/distributed/deparser/deparse_parameter_stmts.c index 1df225601..7c4d5b464 100644 --- a/src/backend/distributed/deparser/deparse_parameter_stmts.c +++ b/src/backend/distributed/deparser/deparse_parameter_stmts.c @@ -62,4 +62,6 @@ DeparseGrantOnParameterStmt(Node *node) return str.data; } + + #endif /* PG_VERSION_NUM >= PG_VERSION_15 */ diff --git a/src/backend/distributed/metadata/metadata_sync.c b/src/backend/distributed/metadata/metadata_sync.c index 879bfbdd4..730c30759 100644 --- a/src/backend/distributed/metadata/metadata_sync.c +++ b/src/backend/distributed/metadata/metadata_sync.c @@ -2165,6 +2165,7 @@ GenerateGrantStmtForRights(ObjectType objectType, withGrantOption); } + /* * GenerateGrantStmtForRightsWithObjectName is the function for creating * GrantStmt's for all types of objects that are supported with object name. @@ -2183,6 +2184,7 @@ GenerateGrantStmtForRightsWithObjectName(ObjectType objectType, permission, withGrantOption); } + /* * BaseGenerateGrantStmtForRights is the base function for creating * GrantStmt's for all types of objects that are supported with object . diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index dd63a985c..c989d1b81 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -448,6 +448,7 @@ extern List * PreprocessDropOwnedStmt(Node *node, const char *queryString, extern List * PostprocessReassignOwnedStmt(Node *node, const char *queryString); #if PG_VERSION_NUM >= PG_VERSION_15 + /* parameter.c - forward declarations */ extern List * PostprocessGrantParameterStmt(Node *node, const char *queryString); #endif /* PG_VERSION_NUM >= PG_VERSION_15 */ diff --git a/src/include/distributed/deparser.h b/src/include/distributed/deparser.h index ec630c3d0..69e2f8cf9 100644 --- a/src/include/distributed/deparser.h +++ b/src/include/distributed/deparser.h @@ -255,6 +255,7 @@ extern char * DeparseDropDatabaseStmt(Node *node); extern char * DeparseAlterDatabaseRenameStmt(Node *node); #if PG_VERSION_NUM >= PG_VERSION_15 + /* forward declarations for deparse_parameter_stmts.c*/ extern char * DeparseGrantOnParameterStmt(Node *node); #endif /* PG_VERSION_NUM >= PG_VERSION_15 */