Rename CitusProcessUtility -> ProcessUtilityForNode

pull/4544/head
Onder Kalaci 2021-01-20 13:47:42 +03:00
parent 082899ffa4
commit 8df58926c5
8 changed files with 51 additions and 47 deletions

View File

@ -629,8 +629,8 @@ ConvertTable(TableConversionState *con)
Node *parseTree = ParseTreeNode(tableCreationSql); Node *parseTree = ParseTreeNode(tableCreationSql);
RelayEventExtendNames(parseTree, con->schemaName, con->hashOfName); RelayEventExtendNames(parseTree, con->schemaName, con->hashOfName);
CitusProcessUtility(parseTree, tableCreationSql, PROCESS_UTILITY_TOPLEVEL, ProcessUtilityParseTree(parseTree, tableCreationSql, PROCESS_UTILITY_TOPLEVEL,
NULL, None_Receiver, NULL); NULL, None_Receiver, NULL);
} }
/* set columnar options */ /* set columnar options */
@ -682,8 +682,9 @@ ConvertTable(TableConversionState *con)
{ {
Node *parseTree = ParseTreeNode(attachPartitionCommand); Node *parseTree = ParseTreeNode(attachPartitionCommand);
CitusProcessUtility(parseTree, attachPartitionCommand, PROCESS_UTILITY_TOPLEVEL, ProcessUtilityParseTree(parseTree, attachPartitionCommand,
NULL, None_Receiver, NULL); PROCESS_UTILITY_TOPLEVEL,
NULL, None_Receiver, NULL);
} }
if (isPartitionTable) if (isPartitionTable)

View File

@ -426,8 +426,8 @@ ExecuteAndLogDDLCommand(const char *commandString)
ereport(DEBUG4, (errmsg("executing \"%s\"", commandString))); ereport(DEBUG4, (errmsg("executing \"%s\"", commandString)));
Node *parseTree = ParseTreeNode(commandString); Node *parseTree = ParseTreeNode(commandString);
CitusProcessUtility(parseTree, commandString, PROCESS_UTILITY_TOPLEVEL, ProcessUtilityParseTree(parseTree, commandString, PROCESS_UTILITY_TOPLEVEL,
NULL, None_Receiver, NULL); NULL, None_Receiver, NULL);
} }
@ -478,6 +478,6 @@ ExecuteForeignKeyCreateCommand(const char *commandString, bool skip_validation)
"command \"%s\"", commandString))); "command \"%s\"", commandString)));
} }
CitusProcessUtility(parseTree, commandString, PROCESS_UTILITY_TOPLEVEL, ProcessUtilityParseTree(parseTree, commandString, PROCESS_UTILITY_TOPLEVEL,
NULL, None_Receiver, NULL); NULL, None_Receiver, NULL);
} }

View File

@ -84,13 +84,14 @@ static bool IsDropSchemaOrDB(Node *parsetree);
/* /*
* CitusProcessUtility is a convenience method to create a PlannedStmt out of pieces of a * ProcessUtilityForParseTree is a convenience method to create a PlannedStmt out of
* utility statement before invoking ProcessUtility. * pieces of a utility statement before invoking ProcessUtility.
*/ */
void void
CitusProcessUtility(Node *node, const char *queryString, ProcessUtilityContext context, ProcessUtilityParseTree(Node *node, const char *queryString, ProcessUtilityContext
ParamListInfo params, DestReceiver *dest, context,
QueryCompletionCompat *completionTag) ParamListInfo params, DestReceiver *dest,
QueryCompletionCompat *completionTag)
{ {
PlannedStmt *plannedStmt = makeNode(PlannedStmt); PlannedStmt *plannedStmt = makeNode(PlannedStmt);
plannedStmt->commandType = CMD_UTILITY; plannedStmt->commandType = CMD_UTILITY;

View File

@ -409,8 +409,9 @@ LocallyExecuteUtilityTask(const char *localTaskQueryCommand)
* It is a regular utility command we should execute it locally via * It is a regular utility command we should execute it locally via
* process utility. * process utility.
*/ */
CitusProcessUtility(localTaskRawParseTree, localTaskQueryCommand, ProcessUtilityParseTree(localTaskRawParseTree, localTaskQueryCommand,
PROCESS_UTILITY_TOPLEVEL, NULL, None_Receiver, NULL); PROCESS_UTILITY_TOPLEVEL, NULL, None_Receiver,
NULL);
} }
} }
} }

View File

@ -41,8 +41,8 @@ alter_role_if_exists(PG_FUNCTION_ARGS)
Node *parseTree = ParseTreeNode(utilityQuery); Node *parseTree = ParseTreeNode(utilityQuery);
CitusProcessUtility(parseTree, utilityQuery, PROCESS_UTILITY_TOPLEVEL, NULL, ProcessUtilityParseTree(parseTree, utilityQuery, PROCESS_UTILITY_TOPLEVEL, NULL,
None_Receiver, NULL); None_Receiver, NULL);
PG_RETURN_BOOL(true); PG_RETURN_BOOL(true);
} }
@ -96,11 +96,11 @@ worker_create_or_alter_role(PG_FUNCTION_ARGS)
quote_literal_cstr(createRoleUtilityQuery)))); quote_literal_cstr(createRoleUtilityQuery))));
} }
CitusProcessUtility(parseTree, ProcessUtilityParseTree(parseTree,
createRoleUtilityQuery, createRoleUtilityQuery,
PROCESS_UTILITY_TOPLEVEL, PROCESS_UTILITY_TOPLEVEL,
NULL, NULL,
None_Receiver, NULL); None_Receiver, NULL);
PG_RETURN_BOOL(true); PG_RETURN_BOOL(true);
} }
@ -124,11 +124,11 @@ worker_create_or_alter_role(PG_FUNCTION_ARGS)
quote_literal_cstr(alterRoleUtilityQuery)))); quote_literal_cstr(alterRoleUtilityQuery))));
} }
CitusProcessUtility(parseTree, ProcessUtilityParseTree(parseTree,
alterRoleUtilityQuery, alterRoleUtilityQuery,
PROCESS_UTILITY_TOPLEVEL, PROCESS_UTILITY_TOPLEVEL,
NULL, NULL,
None_Receiver, NULL); None_Receiver, NULL);
PG_RETURN_BOOL(true); PG_RETURN_BOOL(true);
} }

View File

@ -110,14 +110,14 @@ worker_create_or_replace_object(PG_FUNCTION_ARGS)
RenameStmt *renameStmt = CreateRenameStatement(&address, newName); RenameStmt *renameStmt = CreateRenameStatement(&address, newName);
const char *sqlRenameStmt = DeparseTreeNode((Node *) renameStmt); const char *sqlRenameStmt = DeparseTreeNode((Node *) renameStmt);
CitusProcessUtility((Node *) renameStmt, sqlRenameStmt, ProcessUtilityParseTree((Node *) renameStmt, sqlRenameStmt,
PROCESS_UTILITY_TOPLEVEL, PROCESS_UTILITY_TOPLEVEL,
NULL, None_Receiver, NULL); NULL, None_Receiver, NULL);
} }
/* apply create statement locally */ /* apply create statement locally */
CitusProcessUtility(parseTree, sqlStatement, PROCESS_UTILITY_TOPLEVEL, NULL, ProcessUtilityParseTree(parseTree, sqlStatement, PROCESS_UTILITY_TOPLEVEL, NULL,
None_Receiver, NULL); None_Receiver, NULL);
/* type has been created */ /* type has been created */
PG_RETURN_BOOL(true); PG_RETURN_BOOL(true);

View File

@ -396,8 +396,8 @@ worker_apply_shard_ddl_command(PG_FUNCTION_ARGS)
/* extend names in ddl command and apply extended command */ /* extend names in ddl command and apply extended command */
RelayEventExtendNames(ddlCommandNode, schemaName, shardId); RelayEventExtendNames(ddlCommandNode, schemaName, shardId);
CitusProcessUtility(ddlCommandNode, ddlCommand, PROCESS_UTILITY_TOPLEVEL, NULL, ProcessUtilityParseTree(ddlCommandNode, ddlCommand, PROCESS_UTILITY_TOPLEVEL, NULL,
None_Receiver, NULL); None_Receiver, NULL);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
@ -428,8 +428,8 @@ worker_apply_inter_shard_ddl_command(PG_FUNCTION_ARGS)
RelayEventExtendNamesForInterShardCommands(ddlCommandNode, leftShardId, RelayEventExtendNamesForInterShardCommands(ddlCommandNode, leftShardId,
leftShardSchemaName, rightShardId, leftShardSchemaName, rightShardId,
rightShardSchemaName); rightShardSchemaName);
CitusProcessUtility(ddlCommandNode, ddlCommand, PROCESS_UTILITY_TOPLEVEL, NULL, ProcessUtilityParseTree(ddlCommandNode, ddlCommand, PROCESS_UTILITY_TOPLEVEL, NULL,
None_Receiver, NULL); None_Receiver, NULL);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
@ -461,8 +461,8 @@ worker_apply_sequence_command(PG_FUNCTION_ARGS)
} }
/* run the CREATE SEQUENCE command */ /* run the CREATE SEQUENCE command */
CitusProcessUtility(commandNode, commandString, PROCESS_UTILITY_TOPLEVEL, NULL, ProcessUtilityParseTree(commandNode, commandString, PROCESS_UTILITY_TOPLEVEL, NULL,
None_Receiver, NULL); None_Receiver, NULL);
CommandCounterIncrement(); CommandCounterIncrement();
CreateSeqStmt *createSequenceStatement = (CreateSeqStmt *) commandNode; CreateSeqStmt *createSequenceStatement = (CreateSeqStmt *) commandNode;
@ -668,8 +668,8 @@ worker_append_table_to_shard(PG_FUNCTION_ARGS)
GetUserIdAndSecContext(&savedUserId, &savedSecurityContext); GetUserIdAndSecContext(&savedUserId, &savedSecurityContext);
SetUserIdAndSecContext(CitusExtensionOwner(), SECURITY_LOCAL_USERID_CHANGE); SetUserIdAndSecContext(CitusExtensionOwner(), SECURITY_LOCAL_USERID_CHANGE);
CitusProcessUtility((Node *) localCopyCommand, queryString->data, ProcessUtilityParseTree((Node *) localCopyCommand, queryString->data,
PROCESS_UTILITY_TOPLEVEL, NULL, None_Receiver, NULL); PROCESS_UTILITY_TOPLEVEL, NULL, None_Receiver, NULL);
SetUserIdAndSecContext(savedUserId, savedSecurityContext); SetUserIdAndSecContext(savedUserId, savedSecurityContext);
@ -781,8 +781,8 @@ AlterSequenceMinMax(Oid sequenceId, char *schemaName, char *sequenceName,
SetDefElemArg(alterSequenceStatement, "restart", startFloatArg); SetDefElemArg(alterSequenceStatement, "restart", startFloatArg);
/* since the command is an AlterSeqStmt, a dummy command string works fine */ /* since the command is an AlterSeqStmt, a dummy command string works fine */
CitusProcessUtility((Node *) alterSequenceStatement, dummyString, ProcessUtilityParseTree((Node *) alterSequenceStatement, dummyString,
PROCESS_UTILITY_TOPLEVEL, NULL, None_Receiver, NULL); PROCESS_UTILITY_TOPLEVEL, NULL, None_Receiver, NULL);
} }
} }

View File

@ -65,11 +65,12 @@ extern void multi_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
struct QueryEnvironment *queryEnv, DestReceiver *dest, struct QueryEnvironment *queryEnv, DestReceiver *dest,
QueryCompletionCompat *completionTag QueryCompletionCompat *completionTag
); );
extern void CitusProcessUtility(Node *node, const char *queryString, extern void ProcessUtilityParseTree(Node *node, const char *queryString,
ProcessUtilityContext context, ParamListInfo params, ProcessUtilityContext context, ParamListInfo
DestReceiver *dest, params,
QueryCompletionCompat *completionTag DestReceiver *dest,
); QueryCompletionCompat *completionTag
);
extern void MarkInvalidateForeignKeyGraph(void); extern void MarkInvalidateForeignKeyGraph(void);
extern void InvalidateForeignKeyGraphForDDL(void); extern void InvalidateForeignKeyGraphForDDL(void);
extern List * DDLTaskList(Oid relationId, const char *commandString); extern List * DDLTaskList(Oid relationId, const char *commandString);