Pass ProcessUtilityContext to .preprocess

pull/4479/head
Onur Tirtir 2021-01-05 12:31:01 +03:00
parent ac7bccd847
commit 05931b8fe2
16 changed files with 212 additions and 101 deletions

View File

@ -17,7 +17,8 @@
/* placeholder for PreprocessClusterStmt */ /* placeholder for PreprocessClusterStmt */
List * List *
PreprocessClusterStmt(Node *node, const char *clusterCommand) PreprocessClusterStmt(Node *node, const char *clusterCommand,
ProcessUtilityContext processUtilityContext)
{ {
ClusterStmt *clusterStmt = castNode(ClusterStmt, node); ClusterStmt *clusterStmt = castNode(ClusterStmt, node);
bool showPropagationWarning = false; bool showPropagationWarning = false;

View File

@ -220,7 +220,8 @@ FilterNameListForDistributedCollations(List *objects, bool missing_ok,
List * List *
PreprocessDropCollationStmt(Node *node, const char *queryString) PreprocessDropCollationStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *stmt = castNode(DropStmt, node); DropStmt *stmt = castNode(DropStmt, node);
@ -290,7 +291,8 @@ PreprocessDropCollationStmt(Node *node, const char *queryString)
* the workers to keep the type in sync across the cluster. * the workers to keep the type in sync across the cluster.
*/ */
List * List *
PreprocessAlterCollationOwnerStmt(Node *node, const char *queryString) PreprocessAlterCollationOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node);
Assert(stmt->objectType == OBJECT_COLLATION); Assert(stmt->objectType == OBJECT_COLLATION);
@ -324,7 +326,8 @@ PreprocessAlterCollationOwnerStmt(Node *node, const char *queryString)
* executed on all the workers to keep the collation in sync across the cluster. * executed on all the workers to keep the collation in sync across the cluster.
*/ */
List * List *
PreprocessRenameCollationStmt(Node *node, const char *queryString) PreprocessRenameCollationStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
RenameStmt *stmt = castNode(RenameStmt, node); RenameStmt *stmt = castNode(RenameStmt, node);
ObjectAddress collationAddress = GetObjectAddressFromParseTree((Node *) stmt, false); ObjectAddress collationAddress = GetObjectAddressFromParseTree((Node *) stmt, false);
@ -357,7 +360,8 @@ PreprocessRenameCollationStmt(Node *node, const char *queryString)
* In this stage we can prepare the commands that need to be run on all workers. * In this stage we can prepare the commands that need to be run on all workers.
*/ */
List * List *
PreprocessAlterCollationSchemaStmt(Node *node, const char *queryString) PreprocessAlterCollationSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node);
Assert(stmt->objectType == OBJECT_COLLATION); Assert(stmt->objectType == OBJECT_COLLATION);

View File

@ -239,7 +239,8 @@ AddSchemaFieldIfMissing(CreateExtensionStmt *createExtensionStmt)
* be made to the workers. * be made to the workers.
*/ */
List * List *
PreprocessDropExtensionStmt(Node *node, const char *queryString) PreprocessDropExtensionStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *stmt = castNode(DropStmt, node); DropStmt *stmt = castNode(DropStmt, node);
@ -386,7 +387,8 @@ ExtensionNameListToObjectAddressList(List *extensionObjectList)
* PreprocessAlterExtensionSchemaStmt is invoked for alter extension set schema statements. * PreprocessAlterExtensionSchemaStmt is invoked for alter extension set schema statements.
*/ */
List * List *
PreprocessAlterExtensionSchemaStmt(Node *node, const char *queryString) PreprocessAlterExtensionSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
if (!ShouldPropagateExtensionCommand(node)) if (!ShouldPropagateExtensionCommand(node))
{ {
@ -451,7 +453,8 @@ PostprocessAlterExtensionSchemaStmt(Node *node, const char *queryString)
* PreprocessAlterExtensionUpdateStmt is invoked for alter extension update statements. * PreprocessAlterExtensionUpdateStmt is invoked for alter extension update statements.
*/ */
List * List *
PreprocessAlterExtensionUpdateStmt(Node *node, const char *queryString) PreprocessAlterExtensionUpdateStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterExtensionStmt *alterExtensionStmt = castNode(AlterExtensionStmt, node); AlterExtensionStmt *alterExtensionStmt = castNode(AlterExtensionStmt, node);
@ -599,7 +602,8 @@ MarkExistingObjectDependenciesDistributedIfSupported()
* PreprocessAlterExtensionContentsStmt issues a notice. It does not propagate. * PreprocessAlterExtensionContentsStmt issues a notice. It does not propagate.
*/ */
List * List *
PreprocessAlterExtensionContentsStmt(Node *node, const char *queryString) PreprocessAlterExtensionContentsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
ereport(NOTICE, (errmsg( ereport(NOTICE, (errmsg(
"Citus does not propagate adding/dropping member objects"), "Citus does not propagate adding/dropping member objects"),

View File

@ -1244,7 +1244,8 @@ ShouldPropagateAlterFunction(const ObjectAddress *address)
* can propagate the function in sequential mode. * can propagate the function in sequential mode.
*/ */
List * List *
PreprocessCreateFunctionStmt(Node *node, const char *queryString) PreprocessCreateFunctionStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
CreateFunctionStmt *stmt = castNode(CreateFunctionStmt, node); CreateFunctionStmt *stmt = castNode(CreateFunctionStmt, node);
@ -1356,7 +1357,8 @@ DefineAggregateStmtObjectAddress(Node *node, bool missing_ok)
* the cluster. * the cluster.
*/ */
List * List *
PreprocessAlterFunctionStmt(Node *node, const char *queryString) PreprocessAlterFunctionStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterFunctionStmt *stmt = castNode(AlterFunctionStmt, node); AlterFunctionStmt *stmt = castNode(AlterFunctionStmt, node);
AssertObjectTypeIsFunctional(stmt->objtype); AssertObjectTypeIsFunctional(stmt->objtype);
@ -1390,7 +1392,8 @@ PreprocessAlterFunctionStmt(Node *node, const char *queryString)
* types in sync across the cluster. * types in sync across the cluster.
*/ */
List * List *
PreprocessRenameFunctionStmt(Node *node, const char *queryString) PreprocessRenameFunctionStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
RenameStmt *stmt = castNode(RenameStmt, node); RenameStmt *stmt = castNode(RenameStmt, node);
AssertObjectTypeIsFunctional(stmt->renameType); AssertObjectTypeIsFunctional(stmt->renameType);
@ -1421,7 +1424,8 @@ PreprocessRenameFunctionStmt(Node *node, const char *queryString)
* In this stage we can prepare the commands that need to be run on all workers. * In this stage we can prepare the commands that need to be run on all workers.
*/ */
List * List *
PreprocessAlterFunctionSchemaStmt(Node *node, const char *queryString) PreprocessAlterFunctionSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node);
AssertObjectTypeIsFunctional(stmt->objectType); AssertObjectTypeIsFunctional(stmt->objectType);
@ -1453,7 +1457,8 @@ PreprocessAlterFunctionSchemaStmt(Node *node, const char *queryString)
* all the workers to keep the type in sync across the cluster. * all the workers to keep the type in sync across the cluster.
*/ */
List * List *
PreprocessAlterFunctionOwnerStmt(Node *node, const char *queryString) PreprocessAlterFunctionOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node);
AssertObjectTypeIsFunctional(stmt->objectType); AssertObjectTypeIsFunctional(stmt->objectType);
@ -1487,7 +1492,8 @@ PreprocessAlterFunctionOwnerStmt(Node *node, const char *queryString)
* functions will still be dropped locally but not on the workers. * functions will still be dropped locally but not on the workers.
*/ */
List * List *
PreprocessDropFunctionStmt(Node *node, const char *queryString) PreprocessDropFunctionStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *stmt = castNode(DropStmt, node); DropStmt *stmt = castNode(DropStmt, node);
List *deletingObjectWithArgsList = stmt->objects; List *deletingObjectWithArgsList = stmt->objects;
@ -1591,7 +1597,8 @@ PreprocessDropFunctionStmt(Node *node, const char *queryString)
* don't allow this dependency to be created. * don't allow this dependency to be created.
*/ */
List * List *
PreprocessAlterFunctionDependsStmt(Node *node, const char *queryString) PreprocessAlterFunctionDependsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterObjectDependsStmt *stmt = castNode(AlterObjectDependsStmt, node); AlterObjectDependsStmt *stmt = castNode(AlterObjectDependsStmt, node);
AssertObjectTypeIsFunctional(stmt->objectType); AssertObjectTypeIsFunctional(stmt->objectType);

View File

@ -13,7 +13,8 @@
/* placeholder for PreprocessGrantStmt */ /* placeholder for PreprocessGrantStmt */
List * List *
PreprocessGrantStmt(Node *node, const char *queryString) PreprocessGrantStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
return NIL; return NIL;
} }

View File

@ -130,7 +130,8 @@ IsIndexRenameStmt(RenameStmt *renameStmt)
* in a List. If no distributed table is involved, this function returns NIL. * in a List. If no distributed table is involved, this function returns NIL.
*/ */
List * List *
PreprocessIndexStmt(Node *node, const char *createIndexCommand) PreprocessIndexStmt(Node *node, const char *createIndexCommand,
ProcessUtilityContext processUtilityContext)
{ {
IndexStmt *createIndexStatement = castNode(IndexStmt, node); IndexStmt *createIndexStatement = castNode(IndexStmt, node);
@ -528,7 +529,8 @@ GetCreateIndexRelationLockMode(IndexStmt *createIndexStatement)
* in a List. If no distributed table is involved, this function returns NIL. * in a List. If no distributed table is involved, this function returns NIL.
*/ */
List * List *
PreprocessReindexStmt(Node *node, const char *reindexCommand) PreprocessReindexStmt(Node *node, const char *reindexCommand,
ProcessUtilityContext processUtilityContext)
{ {
ReindexStmt *reindexStatement = castNode(ReindexStmt, node); ReindexStmt *reindexStatement = castNode(ReindexStmt, node);
List *ddlJobs = NIL; List *ddlJobs = NIL;
@ -637,7 +639,8 @@ PreprocessReindexStmt(Node *node, const char *reindexCommand)
* in a List. If no distributed table is involved, this function returns NIL. * in a List. If no distributed table is involved, this function returns NIL.
*/ */
List * List *
PreprocessDropIndexStmt(Node *node, const char *dropIndexCommand) PreprocessDropIndexStmt(Node *node, const char *dropIndexCommand,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *dropIndexStatement = castNode(DropStmt, node); DropStmt *dropIndexStatement = castNode(DropStmt, node);
List *ddlJobs = NIL; List *ddlJobs = NIL;

View File

@ -28,7 +28,8 @@ CreatePolicyCommands(Oid relationId)
/* placeholder for PreprocessCreatePolicyStmt */ /* placeholder for PreprocessCreatePolicyStmt */
List * List *
PreprocessCreatePolicyStmt(Node *node, const char *queryString) PreprocessCreatePolicyStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
CreatePolicyStmt *stmt = castNode(CreatePolicyStmt, node); CreatePolicyStmt *stmt = castNode(CreatePolicyStmt, node);
Oid relationId = RangeVarGetRelid(stmt->table, Oid relationId = RangeVarGetRelid(stmt->table,
@ -48,7 +49,8 @@ PreprocessCreatePolicyStmt(Node *node, const char *queryString)
/* placeholder for PreprocessAlterPolicyStmt */ /* placeholder for PreprocessAlterPolicyStmt */
List * List *
PreprocessAlterPolicyStmt(Node *node, const char *queryString) PreprocessAlterPolicyStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
/* placeholder for future implementation */ /* placeholder for future implementation */
return NIL; return NIL;
@ -71,7 +73,8 @@ ErrorIfUnsupportedPolicy(Relation relation)
/* placeholder for PreprocessDropPolicyStmt */ /* placeholder for PreprocessDropPolicyStmt */
List * List *
PreprocessDropPolicyStmt(Node *node, const char *queryString) PreprocessDropPolicyStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
/* placeholder for future implementation */ /* placeholder for future implementation */
return NIL; return NIL;

View File

@ -26,7 +26,8 @@
* tributed table is involved, this function returns NIL. * tributed table is involved, this function returns NIL.
*/ */
List * List *
PreprocessRenameStmt(Node *node, const char *renameCommand) PreprocessRenameStmt(Node *node, const char *renameCommand,
ProcessUtilityContext processUtilityContext)
{ {
RenameStmt *renameStmt = castNode(RenameStmt, node); RenameStmt *renameStmt = castNode(RenameStmt, node);
Oid objectRelationId = InvalidOid; /* SQL Object OID */ Oid objectRelationId = InvalidOid; /* SQL Object OID */
@ -144,7 +145,8 @@ ErrorIfUnsupportedRenameStmt(RenameStmt *renameStmt)
* a specialized implementation if present, otherwise return an empty list for its DDLJobs * a specialized implementation if present, otherwise return an empty list for its DDLJobs
*/ */
List * List *
PreprocessRenameAttributeStmt(Node *node, const char *queryString) PreprocessRenameAttributeStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
RenameStmt *stmt = castNode(RenameStmt, node); RenameStmt *stmt = castNode(RenameStmt, node);
Assert(stmt->renameType == OBJECT_ATTRIBUTE); Assert(stmt->renameType == OBJECT_ATTRIBUTE);
@ -153,7 +155,8 @@ PreprocessRenameAttributeStmt(Node *node, const char *queryString)
{ {
case OBJECT_TYPE: case OBJECT_TYPE:
{ {
return PreprocessRenameTypeAttributeStmt(node, queryString); return PreprocessRenameTypeAttributeStmt(node, queryString,
processUtilityContext);
} }
default: default:

View File

@ -181,7 +181,8 @@ PostprocessAlterRoleStmt(Node *node, const char *queryString)
* role set statement. * role set statement.
*/ */
List * List *
PreprocessAlterRoleSetStmt(Node *node, const char *queryString) PreprocessAlterRoleSetStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
if (!ShouldPropagate()) if (!ShouldPropagate())
{ {

View File

@ -49,7 +49,8 @@ static void EnsureSequentialModeForSchemaDDL(void);
* under dropped schema involved in any foreign key relationship. * under dropped schema involved in any foreign key relationship.
*/ */
List * List *
PreprocessDropSchemaStmt(Node *node, const char *queryString) PreprocessDropSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *dropStatement = castNode(DropStmt, node); DropStmt *dropStatement = castNode(DropStmt, node);
Relation pgClass = NULL; Relation pgClass = NULL;
@ -133,7 +134,8 @@ PreprocessDropSchemaStmt(Node *node, const char *queryString)
* on schemas. Only grant statements for distributed schema are propagated. * on schemas. Only grant statements for distributed schema are propagated.
*/ */
List * List *
PreprocessGrantOnSchemaStmt(Node *node, const char *queryString) PreprocessGrantOnSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
GrantStmt *stmt = castNode(GrantStmt, node); GrantStmt *stmt = castNode(GrantStmt, node);
Assert(stmt->objtype == OBJECT_SCHEMA); Assert(stmt->objtype == OBJECT_SCHEMA);
@ -166,7 +168,8 @@ PreprocessGrantOnSchemaStmt(Node *node, const char *queryString)
* is executed on all the workers to keep the schemas in sync across the cluster. * is executed on all the workers to keep the schemas in sync across the cluster.
*/ */
List * List *
PreprocessAlterSchemaRenameStmt(Node *node, const char *queryString) PreprocessAlterSchemaRenameStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
ObjectAddress schemaAddress = GetObjectAddressFromParseTree(node, false); ObjectAddress schemaAddress = GetObjectAddressFromParseTree(node, false);
if (!ShouldPropagateObject(&schemaAddress)) if (!ShouldPropagateObject(&schemaAddress))

View File

@ -65,7 +65,8 @@ static char * CreateAlterCommandIfTargetNotDefault(Oid statsOid);
* CREATE STATISTICS. * CREATE STATISTICS.
*/ */
List * List *
PreprocessCreateStatisticsStmt(Node *node, const char *queryString) PreprocessCreateStatisticsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
CreateStatsStmt *stmt = castNode(CreateStatsStmt, node); CreateStatsStmt *stmt = castNode(CreateStatsStmt, node);
@ -150,7 +151,8 @@ CreateStatisticsStmtObjectAddress(Node *node, bool missingOk)
* DROP STATISTICS. * DROP STATISTICS.
*/ */
List * List *
PreprocessDropStatisticsStmt(Node *node, const char *queryString) PreprocessDropStatisticsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *dropStatisticsStmt = castNode(DropStmt, node); DropStmt *dropStatisticsStmt = castNode(DropStmt, node);
Assert(dropStatisticsStmt->removeType == OBJECT_STATISTIC_EXT); Assert(dropStatisticsStmt->removeType == OBJECT_STATISTIC_EXT);
@ -208,7 +210,8 @@ PreprocessDropStatisticsStmt(Node *node, const char *queryString)
* ALTER STATISTICS RENAME. * ALTER STATISTICS RENAME.
*/ */
List * List *
PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString) PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
RenameStmt *renameStmt = castNode(RenameStmt, node); RenameStmt *renameStmt = castNode(RenameStmt, node);
Assert(renameStmt->renameType == OBJECT_STATISTIC_EXT); Assert(renameStmt->renameType == OBJECT_STATISTIC_EXT);
@ -246,7 +249,8 @@ PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString)
* ALTER STATISTICS SET SCHEMA. * ALTER STATISTICS SET SCHEMA.
*/ */
List * List *
PreprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString) PreprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node);
Assert(stmt->objectType == OBJECT_STATISTIC_EXT); Assert(stmt->objectType == OBJECT_STATISTIC_EXT);
@ -338,7 +342,8 @@ AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk)
* ALTER STATISTICS .. SET STATISTICS. * ALTER STATISTICS .. SET STATISTICS.
*/ */
List * List *
PreprocessAlterStatisticsStmt(Node *node, const char *queryString) PreprocessAlterStatisticsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterStatsStmt *stmt = castNode(AlterStatsStmt, node); AlterStatsStmt *stmt = castNode(AlterStatsStmt, node);
@ -377,7 +382,8 @@ PreprocessAlterStatisticsStmt(Node *node, const char *queryString)
* ALTER STATISTICS .. OWNER TO. * ALTER STATISTICS .. OWNER TO.
*/ */
List * List *
PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString) PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node);
Assert(stmt->objectType == OBJECT_STATISTIC_EXT); Assert(stmt->objectType == OBJECT_STATISTIC_EXT);

View File

@ -87,7 +87,8 @@ static bool SetupExecutionModeForAlterTable(Oid relationId, AlterTableCmd *comma
* about not processing same DROP command twice. * about not processing same DROP command twice.
*/ */
List * List *
PreprocessDropTableStmt(Node *node, const char *queryString) PreprocessDropTableStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *dropTableStatement = castNode(DropStmt, node); DropStmt *dropTableStatement = castNode(DropStmt, node);
@ -346,7 +347,8 @@ PostprocessAlterTableSchemaStmt(Node *node, const char *queryString)
* function returns NIL. * function returns NIL.
*/ */
List * List *
PreprocessAlterTableStmt(Node *node, const char *alterTableCommand) PreprocessAlterTableStmt(Node *node, const char *alterTableCommand,
ProcessUtilityContext processUtilityContext)
{ {
AlterTableStmt *alterTableStatement = castNode(AlterTableStmt, node); AlterTableStmt *alterTableStatement = castNode(AlterTableStmt, node);
@ -724,7 +726,8 @@ AlterTableCommandTypeIsTrigger(AlterTableType alterTableType)
* the distributed environment. We warn out here. * the distributed environment. We warn out here.
*/ */
List * List *
PreprocessAlterTableMoveAllStmt(Node *node, const char *queryString) PreprocessAlterTableMoveAllStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
ereport(WARNING, (errmsg("not propagating ALTER TABLE ALL IN TABLESPACE " ereport(WARNING, (errmsg("not propagating ALTER TABLE ALL IN TABLESPACE "
"commands to worker nodes"), "commands to worker nodes"),
@ -743,7 +746,8 @@ PreprocessAlterTableMoveAllStmt(Node *node, const char *queryString)
* shards. * shards.
*/ */
List * List *
PreprocessAlterTableSchemaStmt(Node *node, const char *queryString) PreprocessAlterTableSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node);
Assert(stmt->objectType == OBJECT_TABLE); Assert(stmt->objectType == OBJECT_TABLE);

View File

@ -483,7 +483,8 @@ GetAlterTriggerDependsTriggerNameValue(AlterObjectDependsStmt *alterTriggerDepen
* standard process utility. * standard process utility.
*/ */
List * List *
PreprocessDropTriggerStmt(Node *node, const char *queryString) PreprocessDropTriggerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *dropTriggerStmt = castNode(DropStmt, node); DropStmt *dropTriggerStmt = castNode(DropStmt, node);
Assert(dropTriggerStmt->removeType == OBJECT_TRIGGER); Assert(dropTriggerStmt->removeType == OBJECT_TRIGGER);

View File

@ -116,7 +116,8 @@ static bool ShouldPropagateTypeCreate(void);
* access to the ObjectAddress of the new type. * access to the ObjectAddress of the new type.
*/ */
List * List *
PreprocessCompositeTypeStmt(Node *node, const char *queryString) PreprocessCompositeTypeStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
if (!ShouldPropagateTypeCreate()) if (!ShouldPropagateTypeCreate())
{ {
@ -201,7 +202,8 @@ PostprocessCompositeTypeStmt(Node *node, const char *queryString)
* this is already implemented by the post processing for adding columns to tables. * this is already implemented by the post processing for adding columns to tables.
*/ */
List * List *
PreprocessAlterTypeStmt(Node *node, const char *queryString) PreprocessAlterTypeStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterTableStmt *stmt = castNode(AlterTableStmt, node); AlterTableStmt *stmt = castNode(AlterTableStmt, node);
Assert(stmt->relkind == OBJECT_TYPE); Assert(stmt->relkind == OBJECT_TYPE);
@ -244,7 +246,8 @@ PreprocessAlterTypeStmt(Node *node, const char *queryString)
* ObjectAddress for the new type just yet. * ObjectAddress for the new type just yet.
*/ */
List * List *
PreprocessCreateEnumStmt(Node *node, const char *queryString) PreprocessCreateEnumStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
if (!ShouldPropagateTypeCreate()) if (!ShouldPropagateTypeCreate())
{ {
@ -316,7 +319,8 @@ PostprocessCreateEnumStmt(Node *node, const char *queryString)
* workers directly to keep the types in sync accross the cluster. * workers directly to keep the types in sync accross the cluster.
*/ */
List * List *
PreprocessAlterEnumStmt(Node *node, const char *queryString) PreprocessAlterEnumStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
List *commands = NIL; List *commands = NIL;
@ -446,7 +450,8 @@ PostprocessAlterEnumStmt(Node *node, const char *queryString)
* no types in the drop list are distributed no calls will be made to the workers. * no types in the drop list are distributed no calls will be made to the workers.
*/ */
List * List *
PreprocessDropTypeStmt(Node *node, const char *queryString) PreprocessDropTypeStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
DropStmt *stmt = castNode(DropStmt, node); DropStmt *stmt = castNode(DropStmt, node);
@ -514,7 +519,8 @@ PreprocessDropTypeStmt(Node *node, const char *queryString)
* executed on all the workers to keep the types in sync across the cluster. * executed on all the workers to keep the types in sync across the cluster.
*/ */
List * List *
PreprocessRenameTypeStmt(Node *node, const char *queryString) PreprocessRenameTypeStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
ObjectAddress typeAddress = GetObjectAddressFromParseTree(node, false); ObjectAddress typeAddress = GetObjectAddressFromParseTree(node, false);
if (!ShouldPropagateObject(&typeAddress)) if (!ShouldPropagateObject(&typeAddress))
@ -547,7 +553,8 @@ PreprocessRenameTypeStmt(Node *node, const char *queryString)
* keep the type in sync across the cluster. * keep the type in sync across the cluster.
*/ */
List * List *
PreprocessRenameTypeAttributeStmt(Node *node, const char *queryString) PreprocessRenameTypeAttributeStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
RenameStmt *stmt = castNode(RenameStmt, node); RenameStmt *stmt = castNode(RenameStmt, node);
Assert(stmt->renameType == OBJECT_ATTRIBUTE); Assert(stmt->renameType == OBJECT_ATTRIBUTE);
@ -579,7 +586,8 @@ PreprocessRenameTypeAttributeStmt(Node *node, const char *queryString)
* In this stage we can prepare the commands that need to be run on all workers. * In this stage we can prepare the commands that need to be run on all workers.
*/ */
List * List *
PreprocessAlterTypeSchemaStmt(Node *node, const char *queryString) PreprocessAlterTypeSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node);
Assert(stmt->objectType == OBJECT_TYPE); Assert(stmt->objectType == OBJECT_TYPE);
@ -637,7 +645,8 @@ PostprocessAlterTypeSchemaStmt(Node *node, const char *queryString)
* the workers to keep the type in sync across the cluster. * the workers to keep the type in sync across the cluster.
*/ */
List * List *
PreprocessAlterTypeOwnerStmt(Node *node, const char *queryString) PreprocessAlterTypeOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext)
{ {
AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node);
Assert(stmt->objectType == OBJECT_TYPE); Assert(stmt->objectType == OBJECT_TYPE);

View File

@ -384,7 +384,7 @@ multi_ProcessUtility(PlannedStmt *pstmt,
if (ops && ops->preprocess) if (ops && ops->preprocess)
{ {
ddlJobs = ops->preprocess(parsetree, queryString); ddlJobs = ops->preprocess(parsetree, queryString, context);
} }
} }
else else

View File

@ -18,6 +18,7 @@
#include "utils/rel.h" #include "utils/rel.h"
#include "nodes/parsenodes.h" #include "nodes/parsenodes.h"
#include "tcop/dest.h" #include "tcop/dest.h"
#include "tcop/utility.h"
/* /*
* DistributeObjectOps specifies handlers for node/object type pairs. * DistributeObjectOps specifies handlers for node/object type pairs.
@ -39,7 +40,7 @@ typedef struct DistributeObjectOps
{ {
char * (*deparse)(Node *); char * (*deparse)(Node *);
void (*qualify)(Node *); void (*qualify)(Node *);
List * (*preprocess)(Node *, const char *); List * (*preprocess)(Node *, const char *, ProcessUtilityContext);
List * (*postprocess)(Node *, const char *); List * (*postprocess)(Node *, const char *);
ObjectAddress (*address)(Node *, bool); ObjectAddress (*address)(Node *, bool);
} DistributeObjectOps; } DistributeObjectOps;
@ -102,7 +103,8 @@ typedef enum SearchForeignKeyColumnFlags
/* cluster.c - forward declarations */ /* cluster.c - forward declarations */
extern List * PreprocessClusterStmt(Node *node, const char *clusterCommand); extern List * PreprocessClusterStmt(Node *node, const char *clusterCommand,
ProcessUtilityContext processUtilityContext);
/* index.c */ /* index.c */
typedef void (*PGIndexProcessor)(Form_pg_index, List **); typedef void (*PGIndexProcessor)(Form_pg_index, List **);
@ -116,10 +118,16 @@ extern bool CallDistributedProcedureRemotely(CallStmt *callStmt, DestReceiver *d
extern char * CreateCollationDDL(Oid collationId); extern char * CreateCollationDDL(Oid collationId);
extern List * CreateCollationDDLsIdempotent(Oid collationId); extern List * CreateCollationDDLsIdempotent(Oid collationId);
extern ObjectAddress AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok); extern ObjectAddress AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok);
extern List * PreprocessDropCollationStmt(Node *stmt, const char *queryString); extern List * PreprocessDropCollationStmt(Node *stmt, const char *queryString,
extern List * PreprocessAlterCollationOwnerStmt(Node *stmt, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterCollationSchemaStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterCollationOwnerStmt(Node *stmt, const char *queryString,
extern List * PreprocessRenameCollationStmt(Node *stmt, const char *queryString); ProcessUtilityContext
processUtilityContext);
extern List * PreprocessAlterCollationSchemaStmt(Node *stmt, const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern List * PreprocessRenameCollationStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern ObjectAddress RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok); extern ObjectAddress RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok);
extern ObjectAddress AlterCollationSchemaStmtObjectAddress(Node *stmt, extern ObjectAddress AlterCollationSchemaStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
@ -133,16 +141,23 @@ extern bool IsDropCitusExtensionStmt(Node *parsetree);
extern bool IsCreateAlterExtensionUpdateCitusStmt(Node *parsetree); extern bool IsCreateAlterExtensionUpdateCitusStmt(Node *parsetree);
extern void ErrorIfUnstableCreateOrAlterExtensionStmt(Node *parsetree); extern void ErrorIfUnstableCreateOrAlterExtensionStmt(Node *parsetree);
extern List * PostprocessCreateExtensionStmt(Node *stmt, const char *queryString); extern List * PostprocessCreateExtensionStmt(Node *stmt, const char *queryString);
extern List * PreprocessDropExtensionStmt(Node *stmt, const char *queryString); extern List * PreprocessDropExtensionStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterExtensionSchemaStmt(Node *stmt, extern List * PreprocessAlterExtensionSchemaStmt(Node *stmt,
const char *queryString); const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern List * PostprocessAlterExtensionSchemaStmt(Node *stmt, extern List * PostprocessAlterExtensionSchemaStmt(Node *stmt,
const char *queryString); const char *queryString);
extern List * PreprocessAlterExtensionUpdateStmt(Node *stmt, extern List * PreprocessAlterExtensionUpdateStmt(Node *stmt,
const char *queryString); const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern void PostprocessAlterExtensionCitusUpdateStmt(Node *node); extern void PostprocessAlterExtensionCitusUpdateStmt(Node *node);
extern List * PreprocessAlterExtensionContentsStmt(Node *node, extern List * PreprocessAlterExtensionContentsStmt(Node *node,
const char *queryString); const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern List * CreateExtensionDDLCommand(const ObjectAddress *extensionAddress); extern List * CreateExtensionDDLCommand(const ObjectAddress *extensionAddress);
extern ObjectAddress AlterExtensionSchemaStmtObjectAddress(Node *stmt, extern ObjectAddress AlterExtensionSchemaStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
@ -182,51 +197,64 @@ extern bool RelationInvolvedInAnyNonInheritedForeignKeys(Oid relationId);
/* function.c - forward declarations */ /* function.c - forward declarations */
extern List * PreprocessCreateFunctionStmt(Node *stmt, const char *queryString); extern List * PreprocessCreateFunctionStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PostprocessCreateFunctionStmt(Node *stmt, extern List * PostprocessCreateFunctionStmt(Node *stmt,
const char *queryString); const char *queryString);
extern ObjectAddress CreateFunctionStmtObjectAddress(Node *stmt, extern ObjectAddress CreateFunctionStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
extern ObjectAddress DefineAggregateStmtObjectAddress(Node *stmt, extern ObjectAddress DefineAggregateStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
extern List * PreprocessAlterFunctionStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterFunctionStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern ObjectAddress AlterFunctionStmtObjectAddress(Node *stmt, extern ObjectAddress AlterFunctionStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
extern List * PreprocessRenameFunctionStmt(Node *stmt, const char *queryString); extern List * PreprocessRenameFunctionStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern ObjectAddress RenameFunctionStmtObjectAddress(Node *stmt, extern ObjectAddress RenameFunctionStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
extern List * PreprocessAlterFunctionOwnerStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterFunctionOwnerStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern ObjectAddress AlterFunctionOwnerObjectAddress(Node *stmt, extern ObjectAddress AlterFunctionOwnerObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
extern List * PreprocessAlterFunctionSchemaStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterFunctionSchemaStmt(Node *stmt, const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern ObjectAddress AlterFunctionSchemaStmtObjectAddress(Node *stmt, extern ObjectAddress AlterFunctionSchemaStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
extern List * PostprocessAlterFunctionSchemaStmt(Node *stmt, extern List * PostprocessAlterFunctionSchemaStmt(Node *stmt,
const char *queryString); const char *queryString);
extern List * PreprocessDropFunctionStmt(Node *stmt, const char *queryString); extern List * PreprocessDropFunctionStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterFunctionDependsStmt(Node *stmt, extern List * PreprocessAlterFunctionDependsStmt(Node *stmt,
const char *queryString); const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern ObjectAddress AlterFunctionDependsStmtObjectAddress(Node *stmt, extern ObjectAddress AlterFunctionDependsStmtObjectAddress(Node *stmt,
bool missing_ok); bool missing_ok);
/* grant.c - forward declarations */ /* grant.c - forward declarations */
extern List * PreprocessGrantStmt(Node *node, const char *queryString); extern List * PreprocessGrantStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
/* index.c - forward declarations */ /* index.c - forward declarations */
extern bool IsIndexRenameStmt(RenameStmt *renameStmt); extern bool IsIndexRenameStmt(RenameStmt *renameStmt);
extern List * PreprocessIndexStmt(Node *createIndexStatement, extern List * PreprocessIndexStmt(Node *createIndexStatement,
const char *createIndexCommand); const char *createIndexCommand,
ProcessUtilityContext processUtilityContext);
extern char * ChooseIndexName(const char *tabname, Oid namespaceId, extern char * ChooseIndexName(const char *tabname, Oid namespaceId,
List *colnames, List *exclusionOpNames, List *colnames, List *exclusionOpNames,
bool primary, bool isconstraint); bool primary, bool isconstraint);
extern char * ChooseIndexNameAddition(List *colnames); extern char * ChooseIndexNameAddition(List *colnames);
extern List * ChooseIndexColumnNames(List *indexElems); extern List * ChooseIndexColumnNames(List *indexElems);
extern List * PreprocessReindexStmt(Node *ReindexStatement, extern List * PreprocessReindexStmt(Node *ReindexStatement,
const char *ReindexCommand); const char *ReindexCommand,
ProcessUtilityContext processUtilityContext);
extern List * PreprocessDropIndexStmt(Node *dropIndexStatement, extern List * PreprocessDropIndexStmt(Node *dropIndexStatement,
const char *dropIndexCommand); const char *dropIndexCommand,
ProcessUtilityContext processUtilityContext);
extern List * PostprocessIndexStmt(Node *node, extern List * PostprocessIndexStmt(Node *node,
const char *queryString); const char *queryString);
extern void ErrorIfUnsupportedAlterIndexStmt(AlterTableStmt *alterTableStatement); extern void ErrorIfUnsupportedAlterIndexStmt(AlterTableStmt *alterTableStatement);
@ -241,9 +269,12 @@ extern ObjectAddress CreateExtensionStmtObjectAddress(Node *stmt, bool missing_o
/* policy.c - forward declarations */ /* policy.c - forward declarations */
extern List * CreatePolicyCommands(Oid relationId); extern List * CreatePolicyCommands(Oid relationId);
extern void ErrorIfUnsupportedPolicy(Relation relation); extern void ErrorIfUnsupportedPolicy(Relation relation);
extern List * PreprocessCreatePolicyStmt(Node *node, const char *queryString); extern List * PreprocessCreatePolicyStmt(Node *node, const char *queryString,
extern List * PreprocessAlterPolicyStmt(Node *node, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessDropPolicyStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterPolicyStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PreprocessDropPolicyStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern bool IsPolicyRenameStmt(RenameStmt *stmt); extern bool IsPolicyRenameStmt(RenameStmt *stmt);
extern void CreatePolicyEventExtendNames(CreatePolicyStmt *stmt, const char *schemaName, extern void CreatePolicyEventExtendNames(CreatePolicyStmt *stmt, const char *schemaName,
uint64 shardId); uint64 shardId);
@ -256,14 +287,17 @@ extern void DropPolicyEventExtendNames(DropStmt *stmt, const char *schemaName, u
/* rename.c - forward declarations*/ /* rename.c - forward declarations*/
extern List * PreprocessRenameStmt(Node *renameStmt, const char *renameCommand); extern List * PreprocessRenameStmt(Node *renameStmt, const char *renameCommand,
ProcessUtilityContext processUtilityContext);
extern void ErrorIfUnsupportedRenameStmt(RenameStmt *renameStmt); extern void ErrorIfUnsupportedRenameStmt(RenameStmt *renameStmt);
extern List * PreprocessRenameAttributeStmt(Node *stmt, const char *queryString); extern List * PreprocessRenameAttributeStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
/* role.c - forward declarations*/ /* role.c - forward declarations*/
extern List * PostprocessAlterRoleStmt(Node *stmt, const char *queryString); extern List * PostprocessAlterRoleStmt(Node *stmt, const char *queryString);
extern List * PreprocessAlterRoleSetStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterRoleSetStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * GenerateAlterRoleSetCommandForRole(Oid roleid); extern List * GenerateAlterRoleSetCommandForRole(Oid roleid);
extern ObjectAddress AlterRoleStmtObjectAddress(Node *node, extern ObjectAddress AlterRoleStmtObjectAddress(Node *node,
bool missing_ok); bool missing_ok);
@ -273,11 +307,14 @@ extern List * GenerateCreateOrAlterRoleCommand(Oid roleOid);
/* schema.c - forward declarations */ /* schema.c - forward declarations */
extern List * PreprocessDropSchemaStmt(Node *dropSchemaStatement, extern List * PreprocessDropSchemaStmt(Node *dropSchemaStatement,
const char *queryString); const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterObjectSchemaStmt(Node *alterObjectSchemaStmt, extern List * PreprocessAlterObjectSchemaStmt(Node *alterObjectSchemaStmt,
const char *alterObjectSchemaCommand); const char *alterObjectSchemaCommand);
extern List * PreprocessGrantOnSchemaStmt(Node *node, const char *queryString); extern List * PreprocessGrantOnSchemaStmt(Node *node, const char *queryString,
extern List * PreprocessAlterSchemaRenameStmt(Node *node, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterSchemaRenameStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern ObjectAddress AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok); extern ObjectAddress AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok);
/* sequence.c - forward declarations */ /* sequence.c - forward declarations */
@ -285,16 +322,25 @@ extern void ErrorIfUnsupportedSeqStmt(CreateSeqStmt *createSeqStmt);
extern void ErrorIfDistributedAlterSeqOwnedBy(AlterSeqStmt *alterSeqStmt); extern void ErrorIfDistributedAlterSeqOwnedBy(AlterSeqStmt *alterSeqStmt);
/* statistics.c - forward declarations */ /* statistics.c - forward declarations */
extern List * PreprocessCreateStatisticsStmt(Node *node, const char *queryString); extern List * PreprocessCreateStatisticsStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PostprocessCreateStatisticsStmt(Node *node, const char *queryString); extern List * PostprocessCreateStatisticsStmt(Node *node, const char *queryString);
extern ObjectAddress CreateStatisticsStmtObjectAddress(Node *node, bool missingOk); extern ObjectAddress CreateStatisticsStmtObjectAddress(Node *node, bool missingOk);
extern List * PreprocessDropStatisticsStmt(Node *node, const char *queryString); extern List * PreprocessDropStatisticsStmt(Node *node, const char *queryString,
extern List * PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString); extern List * PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern List * PreprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern List * PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString); extern List * PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString);
extern ObjectAddress AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk); extern ObjectAddress AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk);
extern List * PreprocessAlterStatisticsStmt(Node *node, const char *queryString); extern List * PreprocessAlterStatisticsStmt(Node *node, const char *queryString,
extern List * PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern List * GetExplicitStatisticsCommandList(Oid relationId); extern List * GetExplicitStatisticsCommandList(Oid relationId);
extern List * GetExplicitStatisticsSchemaIdList(Oid relationId); extern List * GetExplicitStatisticsSchemaIdList(Oid relationId);
@ -303,16 +349,20 @@ extern Node * ProcessCreateSubscriptionStmt(CreateSubscriptionStmt *createSubStm
/* table.c - forward declarations */ /* table.c - forward declarations */
extern List * PreprocessDropTableStmt(Node *stmt, const char *queryString); extern List * PreprocessDropTableStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern void PostprocessCreateTableStmt(CreateStmt *createStatement, extern void PostprocessCreateTableStmt(CreateStmt *createStatement,
const char *queryString); const char *queryString);
extern List * PostprocessAlterTableStmtAttachPartition( extern List * PostprocessAlterTableStmtAttachPartition(
AlterTableStmt *alterTableStatement, AlterTableStmt *alterTableStatement,
const char *queryString); const char *queryString);
extern List * PostprocessAlterTableSchemaStmt(Node *node, const char *queryString); extern List * PostprocessAlterTableSchemaStmt(Node *node, const char *queryString);
extern List * PreprocessAlterTableStmt(Node *node, const char *alterTableCommand); extern List * PreprocessAlterTableStmt(Node *node, const char *alterTableCommand,
extern List * PreprocessAlterTableMoveAllStmt(Node *node, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterTableSchemaStmt(Node *node, const char *queryString); extern List * PreprocessAlterTableMoveAllStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterTableSchemaStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern Node * WorkerProcessAlterTableStmt(AlterTableStmt *alterTableStatement, extern Node * WorkerProcessAlterTableStmt(AlterTableStmt *alterTableStatement,
const char *alterTableCommand); const char *alterTableCommand);
extern bool IsAlterTableRenameStmt(RenameStmt *renameStmt); extern bool IsAlterTableRenameStmt(RenameStmt *renameStmt);
@ -332,18 +382,28 @@ extern List * MakeNameListFromRangeVar(const RangeVar *rel);
extern void PreprocessTruncateStatement(TruncateStmt *truncateStatement); extern void PreprocessTruncateStatement(TruncateStmt *truncateStatement);
/* type.c - forward declarations */ /* type.c - forward declarations */
extern List * PreprocessCompositeTypeStmt(Node *stmt, const char *queryString); extern List * PreprocessCompositeTypeStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PostprocessCompositeTypeStmt(Node *stmt, const char *queryString); extern List * PostprocessCompositeTypeStmt(Node *stmt, const char *queryString);
extern List * PreprocessAlterTypeStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterTypeStmt(Node *stmt, const char *queryString,
extern List * PreprocessCreateEnumStmt(Node *stmt, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessCreateEnumStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PostprocessCreateEnumStmt(Node *stmt, const char *queryString); extern List * PostprocessCreateEnumStmt(Node *stmt, const char *queryString);
extern List * PreprocessAlterEnumStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterEnumStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PostprocessAlterEnumStmt(Node *stmt, const char *queryString); extern List * PostprocessAlterEnumStmt(Node *stmt, const char *queryString);
extern List * PreprocessDropTypeStmt(Node *stmt, const char *queryString); extern List * PreprocessDropTypeStmt(Node *stmt, const char *queryString,
extern List * PreprocessRenameTypeStmt(Node *stmt, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessRenameTypeAttributeStmt(Node *stmt, const char *queryString); extern List * PreprocessRenameTypeStmt(Node *stmt, const char *queryString,
extern List * PreprocessAlterTypeSchemaStmt(Node *stmt, const char *queryString); ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterTypeOwnerStmt(Node *stmt, const char *queryString); extern List * PreprocessRenameTypeAttributeStmt(Node *stmt, const char *queryString,
ProcessUtilityContext
processUtilityContext);
extern List * PreprocessAlterTypeSchemaStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PreprocessAlterTypeOwnerStmt(Node *stmt, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern List * PostprocessAlterTypeSchemaStmt(Node *stmt, const char *queryString); extern List * PostprocessAlterTypeSchemaStmt(Node *stmt, const char *queryString);
extern Node * CreateTypeStmtByObjectAddress(const ObjectAddress *address); extern Node * CreateTypeStmtByObjectAddress(const ObjectAddress *address);
extern ObjectAddress CompositeTypeStmtObjectAddress(Node *stmt, bool missing_ok); extern ObjectAddress CompositeTypeStmtObjectAddress(Node *stmt, bool missing_ok);
@ -384,7 +444,8 @@ extern List * PostprocessAlterTriggerDependsStmt(Node *node, const char *querySt
extern void AlterTriggerDependsEventExtendNames( extern void AlterTriggerDependsEventExtendNames(
AlterObjectDependsStmt *alterTriggerDependsStmt, AlterObjectDependsStmt *alterTriggerDependsStmt,
char *schemaName, uint64 shardId); char *schemaName, uint64 shardId);
extern List * PreprocessDropTriggerStmt(Node *node, const char *queryString); extern List * PreprocessDropTriggerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext);
extern void ErrorOutForTriggerIfNotCitusLocalTable(Oid relationId); extern void ErrorOutForTriggerIfNotCitusLocalTable(Oid relationId);
extern void DropTriggerEventExtendNames(DropStmt *dropTriggerStmt, char *schemaName, extern void DropTriggerEventExtendNames(DropStmt *dropTriggerStmt, char *schemaName,
uint64 shardId); uint64 shardId);