Fixes indentation

grant_parameter_propagation
gurkanindibay 2024-01-17 11:36:38 +03:00
parent 0e05dd3c27
commit 15817ab924
6 changed files with 17 additions and 5 deletions

View File

@ -2074,6 +2074,7 @@ GetDistributeObjectOps(Node *node)
{ {
return &Database_Grant; return &Database_Grant;
} }
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
case OBJECT_PARAMETER_ACL: case OBJECT_PARAMETER_ACL:
{ {

View File

@ -68,10 +68,11 @@ GenerateGrantOnParameterFromAclItem(char *parameterName, AclItem *aclItem)
return queries; return queries;
} }
/* /*
* CheckAndAppendQuery checks if the aclItem has the given mode and if it has, it appends the * CheckAndAppendQuery checks if the aclItem has the given mode and if it has, it appends the
* corresponding query to the queries list. * corresponding query to the queries list.
*/ */
static void static void
CheckAndAppendQuery(List **queries, AclItem *aclItem, Oid granteeOid, char *parameterName, CheckAndAppendQuery(List **queries, AclItem *aclItem, Oid granteeOid, char *parameterName,
AclMode mode, char *modeStr) 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 * CheckPermissionsAndGrants checks if the aclItem has the valid permissions and grants
* for the given modes. * for the given modes.
*/ */
static void static void
CheckPermissionsAndGrants(AclItem *aclItem, AclMode modes[], int numModes) 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++) for (int i = 0; i < numModes; i++)
{ {
AclMode mode = modes[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))); ereport(ERROR, (errmsg("ACL item has no grant option for mode %lu", mode)));
} }
} }
@ -166,4 +169,6 @@ GrantOnParameters(void)
return commands; return commands;
} }
#endif /* PG_VERSION_NUM >= PG_VERSION_15 */ #endif /* PG_VERSION_NUM >= PG_VERSION_15 */

View File

@ -62,4 +62,6 @@ DeparseGrantOnParameterStmt(Node *node)
return str.data; return str.data;
} }
#endif /* PG_VERSION_NUM >= PG_VERSION_15 */ #endif /* PG_VERSION_NUM >= PG_VERSION_15 */

View File

@ -2165,6 +2165,7 @@ GenerateGrantStmtForRights(ObjectType objectType,
withGrantOption); withGrantOption);
} }
/* /*
* GenerateGrantStmtForRightsWithObjectName is the function for creating * GenerateGrantStmtForRightsWithObjectName is the function for creating
* GrantStmt's for all types of objects that are supported with object name. * GrantStmt's for all types of objects that are supported with object name.
@ -2183,6 +2184,7 @@ GenerateGrantStmtForRightsWithObjectName(ObjectType objectType,
permission, withGrantOption); permission, withGrantOption);
} }
/* /*
* BaseGenerateGrantStmtForRights is the base function for creating * BaseGenerateGrantStmtForRights is the base function for creating
* GrantStmt's for all types of objects that are supported with object . * GrantStmt's for all types of objects that are supported with object .

View File

@ -448,6 +448,7 @@ extern List * PreprocessDropOwnedStmt(Node *node, const char *queryString,
extern List * PostprocessReassignOwnedStmt(Node *node, const char *queryString); extern List * PostprocessReassignOwnedStmt(Node *node, const char *queryString);
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
/* parameter.c - forward declarations */ /* parameter.c - forward declarations */
extern List * PostprocessGrantParameterStmt(Node *node, const char *queryString); extern List * PostprocessGrantParameterStmt(Node *node, const char *queryString);
#endif /* PG_VERSION_NUM >= PG_VERSION_15 */ #endif /* PG_VERSION_NUM >= PG_VERSION_15 */

View File

@ -255,6 +255,7 @@ extern char * DeparseDropDatabaseStmt(Node *node);
extern char * DeparseAlterDatabaseRenameStmt(Node *node); extern char * DeparseAlterDatabaseRenameStmt(Node *node);
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
/* forward declarations for deparse_parameter_stmts.c*/ /* forward declarations for deparse_parameter_stmts.c*/
extern char * DeparseGrantOnParameterStmt(Node *node); extern char * DeparseGrantOnParameterStmt(Node *node);
#endif /* PG_VERSION_NUM >= PG_VERSION_15 */ #endif /* PG_VERSION_NUM >= PG_VERSION_15 */