From c98a68662a27808afb8bf9679dfc9181483e7198 Mon Sep 17 00:00:00 2001 From: aykutbozkurt Date: Mon, 1 Aug 2022 13:39:14 +0300 Subject: [PATCH] introduces operation type for dist ops --- .../commands/distribute_object_ops.c | 120 ++++++++++++++ src/backend/distributed/commands/role.c | 7 + src/backend/distributed/commands/statistics.c | 16 +- .../distributed/commands/utility_hook.c | 5 +- .../distributed/utils/citus_depended_object.c | 149 +++++++++++++++++- src/include/distributed/commands.h | 11 ++ 6 files changed, 302 insertions(+), 6 deletions(-) diff --git a/src/backend/distributed/commands/distribute_object_ops.c b/src/backend/distributed/commands/distribute_object_ops.c index 78f72d828..b64531381 100644 --- a/src/backend/distributed/commands/distribute_object_ops.c +++ b/src/backend/distributed/commands/distribute_object_ops.c @@ -23,6 +23,7 @@ static DistributeObjectOps NoDistributeOps = { .qualify = NULL, .preprocess = NULL, .postprocess = NULL, + .operationType = DIST_OPS_NONE, .address = NULL, .markDistributed = false, }; @@ -32,6 +33,7 @@ static DistributeObjectOps Aggregate_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionSchemaStmtObjectAddress, .markDistributed = false, }; @@ -41,6 +43,7 @@ static DistributeObjectOps Aggregate_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionOwnerObjectAddress, .markDistributed = false, }; @@ -50,6 +53,7 @@ static DistributeObjectOps Aggregate_Define = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_AGGREGATE, + .operationType = DIST_OPS_CREATE, .address = DefineAggregateStmtObjectAddress, .markDistributed = true, }; @@ -58,6 +62,7 @@ static DistributeObjectOps Aggregate_Drop = { .qualify = NULL, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -67,6 +72,7 @@ static DistributeObjectOps Aggregate_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = RenameFunctionStmtObjectAddress, .markDistributed = false, }; @@ -76,6 +82,7 @@ static DistributeObjectOps Any_AlterEnum = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TYPE, + .operationType = DIST_OPS_ALTER, .address = AlterEnumStmtObjectAddress, .markDistributed = false, }; @@ -84,6 +91,7 @@ static DistributeObjectOps Any_AlterExtension = { .qualify = NULL, .preprocess = PreprocessAlterExtensionUpdateStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = AlterExtensionUpdateStmtObjectAddress, .markDistributed = false, }; @@ -92,6 +100,7 @@ static DistributeObjectOps Any_AlterExtensionContents = { .qualify = NULL, .preprocess = PreprocessAlterExtensionContentsStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -101,6 +110,7 @@ static DistributeObjectOps Any_AlterForeignServer = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_FOREIGN_SERVER, + .operationType = DIST_OPS_ALTER, .address = AlterForeignServerStmtObjectAddress, .markDistributed = false, }; @@ -109,6 +119,7 @@ static DistributeObjectOps Any_AlterFunction = { .qualify = QualifyAlterFunctionStmt, .preprocess = PreprocessAlterFunctionStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionStmtObjectAddress, .markDistributed = false, }; @@ -117,6 +128,7 @@ static DistributeObjectOps Any_AlterPolicy = { .qualify = NULL, .preprocess = PreprocessAlterPolicyStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -125,6 +137,7 @@ static DistributeObjectOps Any_AlterRole = { .qualify = NULL, .preprocess = NULL, .postprocess = PostprocessAlterRoleStmt, + .operationType = DIST_OPS_ALTER, .address = AlterRoleStmtObjectAddress, .markDistributed = false, }; @@ -133,6 +146,7 @@ static DistributeObjectOps Any_AlterRoleSet = { .qualify = QualifyAlterRoleSetStmt, .preprocess = PreprocessAlterRoleSetStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = AlterRoleSetStmtObjectAddress, .markDistributed = false, }; @@ -141,6 +155,7 @@ static DistributeObjectOps Any_AlterTableMoveAll = { .qualify = NULL, .preprocess = PreprocessAlterTableMoveAllStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -149,6 +164,7 @@ static DistributeObjectOps Any_Cluster = { .qualify = NULL, .preprocess = PreprocessClusterStmt, .postprocess = NULL, + .operationType = DIST_OPS_NONE, .address = NULL, .markDistributed = false, }; @@ -158,6 +174,7 @@ static DistributeObjectOps Any_CompositeType = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_TYPE, + .operationType = DIST_OPS_CREATE, .featureFlag = &EnableCreateTypePropagation, .address = CompositeTypeStmtObjectAddress, .markDistributed = true, @@ -168,6 +185,7 @@ static DistributeObjectOps Any_CreateDomain = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_DOMAIN, + .operationType = DIST_OPS_CREATE, .address = CreateDomainStmtObjectAddress, .markDistributed = true, }; @@ -177,6 +195,7 @@ static DistributeObjectOps Any_CreateEnum = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_TYPE, + .operationType = DIST_OPS_CREATE, .featureFlag = &EnableCreateTypePropagation, .address = CreateEnumStmtObjectAddress, .markDistributed = true, @@ -186,6 +205,7 @@ static DistributeObjectOps Any_CreateExtension = { .qualify = NULL, .preprocess = NULL, .postprocess = PostprocessCreateExtensionStmt, + .operationType = DIST_OPS_CREATE, .address = CreateExtensionStmtObjectAddress, .markDistributed = true, }; @@ -194,6 +214,7 @@ static DistributeObjectOps Any_CreateFunction = { .qualify = NULL, .preprocess = PreprocessCreateFunctionStmt, .postprocess = PostprocessCreateFunctionStmt, + .operationType = DIST_OPS_CREATE, .address = CreateFunctionStmtObjectAddress, .markDistributed = true, }; @@ -202,6 +223,7 @@ static DistributeObjectOps Any_View = { .qualify = NULL, .preprocess = PreprocessViewStmt, .postprocess = PostprocessViewStmt, + .operationType = DIST_OPS_CREATE, .address = ViewStmtObjectAddress, .markDistributed = true, }; @@ -210,6 +232,7 @@ static DistributeObjectOps Any_CreatePolicy = { .qualify = NULL, .preprocess = NULL, .postprocess = PostprocessCreatePolicyStmt, + .operationType = DIST_OPS_CREATE, .address = NULL, .markDistributed = false, }; @@ -218,6 +241,7 @@ static DistributeObjectOps Any_CreateRole = { .qualify = NULL, .preprocess = PreprocessCreateRoleStmt, .postprocess = NULL, + .operationType = DIST_OPS_CREATE, .address = CreateRoleStmtObjectAddress, .markDistributed = true, }; @@ -226,6 +250,7 @@ static DistributeObjectOps Any_DropRole = { .qualify = NULL, .preprocess = PreprocessDropRoleStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -235,6 +260,7 @@ static DistributeObjectOps Any_CreateForeignServer = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_FOREIGN_SERVER, + .operationType = DIST_OPS_CREATE, .address = CreateForeignServerStmtObjectAddress, .markDistributed = true, }; @@ -243,6 +269,7 @@ static DistributeObjectOps Any_CreateSchema = { .qualify = NULL, .preprocess = PreprocessCreateSchemaStmt, .postprocess = NULL, + .operationType = DIST_OPS_CREATE, .address = CreateSchemaStmtObjectAddress, .markDistributed = true, }; @@ -251,6 +278,7 @@ static DistributeObjectOps Any_CreateStatistics = { .qualify = QualifyCreateStatisticsStmt, .preprocess = PreprocessCreateStatisticsStmt, .postprocess = PostprocessCreateStatisticsStmt, + .operationType = DIST_OPS_CREATE, .address = CreateStatisticsStmtObjectAddress, .markDistributed = false, }; @@ -259,6 +287,7 @@ static DistributeObjectOps Any_CreateTrigger = { .qualify = NULL, .preprocess = NULL, .postprocess = PostprocessCreateTriggerStmt, + .operationType = DIST_OPS_CREATE, .address = CreateTriggerStmtObjectAddress, .markDistributed = false, }; @@ -267,6 +296,7 @@ static DistributeObjectOps Any_Grant = { .qualify = NULL, .preprocess = PreprocessGrantStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -275,6 +305,7 @@ static DistributeObjectOps Any_GrantRole = { .qualify = NULL, .preprocess = PreprocessGrantRoleStmt, .postprocess = PostprocessGrantRoleStmt, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -283,6 +314,7 @@ static DistributeObjectOps Any_Index = { .qualify = NULL, .preprocess = PreprocessIndexStmt, .postprocess = PostprocessIndexStmt, + .operationType = DIST_OPS_CREATE, .address = NULL, .markDistributed = false, }; @@ -291,6 +323,7 @@ static DistributeObjectOps Any_Reindex = { .qualify = NULL, .preprocess = PreprocessReindexStmt, .postprocess = NULL, + .operationType = DIST_OPS_NONE, .address = ReindexStmtObjectAddress, .markDistributed = false, }; @@ -299,6 +332,7 @@ static DistributeObjectOps Any_Rename = { .qualify = NULL, .preprocess = PreprocessRenameStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -307,6 +341,7 @@ static DistributeObjectOps Attribute_Rename = { .qualify = QualifyRenameAttributeStmt, .preprocess = PreprocessRenameAttributeStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = RenameAttributeStmtObjectAddress, .markDistributed = false, }; @@ -316,6 +351,7 @@ static DistributeObjectOps Collation_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_COLLATION, + .operationType = DIST_OPS_ALTER, .address = AlterCollationSchemaStmtObjectAddress, .markDistributed = false, }; @@ -325,6 +361,7 @@ static DistributeObjectOps Collation_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_COLLATION, + .operationType = DIST_OPS_ALTER, .address = AlterCollationOwnerObjectAddress, .markDistributed = false, }; @@ -334,6 +371,7 @@ static DistributeObjectOps Collation_Define = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_COLLATION, + .operationType = DIST_OPS_CREATE, .address = DefineCollationStmtObjectAddress, .markDistributed = true, }; @@ -342,6 +380,7 @@ static DistributeObjectOps Collation_Drop = { .qualify = QualifyDropCollationStmt, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -351,6 +390,7 @@ static DistributeObjectOps Collation_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_COLLATION, + .operationType = DIST_OPS_ALTER, .address = RenameCollationStmtObjectAddress, .markDistributed = false, }; @@ -360,6 +400,7 @@ static DistributeObjectOps Database_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_DATABASE, + .operationType = DIST_OPS_ALTER, .featureFlag = &EnableAlterDatabaseOwner, .address = AlterDatabaseOwnerObjectAddress, .markDistributed = false, @@ -370,6 +411,7 @@ static DistributeObjectOps Domain_Alter = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_DOMAIN, + .operationType = DIST_OPS_ALTER, .address = AlterDomainStmtObjectAddress, .markDistributed = false, }; @@ -379,6 +421,7 @@ static DistributeObjectOps Domain_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_DOMAIN, + .operationType = DIST_OPS_ALTER, .address = AlterTypeSchemaStmtObjectAddress, .markDistributed = false, }; @@ -388,6 +431,7 @@ static DistributeObjectOps Domain_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_DOMAIN, + .operationType = DIST_OPS_ALTER, .address = AlterDomainOwnerStmtObjectAddress, .markDistributed = false, }; @@ -396,6 +440,7 @@ static DistributeObjectOps Domain_Drop = { .qualify = QualifyDropDomainStmt, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -405,6 +450,7 @@ static DistributeObjectOps Domain_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_DOMAIN, + .operationType = DIST_OPS_ALTER, .address = RenameDomainStmtObjectAddress, .markDistributed = false, }; @@ -415,6 +461,7 @@ static DistributeObjectOps Domain_RenameConstraint = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_DOMAIN, + .operationType = DIST_OPS_ALTER, .address = DomainRenameConstraintStmtObjectAddress, .markDistributed = false, }; @@ -423,6 +470,7 @@ static DistributeObjectOps Extension_AlterObjectSchema = { .qualify = NULL, .preprocess = PreprocessAlterExtensionSchemaStmt, .postprocess = PostprocessAlterExtensionSchemaStmt, + .operationType = DIST_OPS_ALTER, .address = AlterExtensionSchemaStmtObjectAddress, .markDistributed = false, }; @@ -431,6 +479,7 @@ static DistributeObjectOps Extension_Drop = { .qualify = NULL, .preprocess = PreprocessDropExtensionStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -439,6 +488,7 @@ static DistributeObjectOps FDW_Grant = { .qualify = NULL, .preprocess = PreprocessGrantOnFDWStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -447,6 +497,7 @@ static DistributeObjectOps ForeignServer_Drop = { .qualify = NULL, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -455,6 +506,7 @@ static DistributeObjectOps ForeignServer_Grant = { .qualify = NULL, .preprocess = PreprocessGrantOnForeignServerStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -464,6 +516,7 @@ static DistributeObjectOps ForeignServer_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_FOREIGN_SERVER, + .operationType = DIST_OPS_ALTER, .address = RenameForeignServerStmtObjectAddress, .markDistributed = false, }; @@ -473,6 +526,7 @@ static DistributeObjectOps ForeignServer_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FOREIGN_SERVER, + .operationType = DIST_OPS_ALTER, .address = AlterForeignServerOwnerStmtObjectAddress, .markDistributed = false, }; @@ -481,6 +535,7 @@ static DistributeObjectOps ForeignTable_AlterTable = { .qualify = NULL, .preprocess = PreprocessAlterTableStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -489,6 +544,7 @@ static DistributeObjectOps Function_AlterObjectDepends = { .qualify = QualifyAlterFunctionDependsStmt, .preprocess = PreprocessAlterFunctionDependsStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionDependsStmtObjectAddress, .markDistributed = false, }; @@ -498,6 +554,7 @@ static DistributeObjectOps Function_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionSchemaStmtObjectAddress, .markDistributed = false, }; @@ -507,6 +564,7 @@ static DistributeObjectOps Function_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionOwnerObjectAddress, .markDistributed = false, }; @@ -515,6 +573,7 @@ static DistributeObjectOps Function_Drop = { .qualify = NULL, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -523,6 +582,7 @@ static DistributeObjectOps Function_Grant = { .qualify = NULL, .preprocess = PreprocessGrantOnFunctionStmt, .postprocess = PostprocessGrantOnFunctionStmt, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -531,6 +591,7 @@ static DistributeObjectOps View_Drop = { .qualify = QualifyDropViewStmt, .preprocess = PreprocessDropViewStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = DropViewStmtObjectAddress, .markDistributed = false, }; @@ -540,6 +601,7 @@ static DistributeObjectOps Function_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = RenameFunctionStmtObjectAddress, .markDistributed = false, }; @@ -548,6 +610,7 @@ static DistributeObjectOps Index_AlterTable = { .qualify = NULL, .preprocess = PreprocessAlterTableStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -556,6 +619,7 @@ static DistributeObjectOps Index_Drop = { .qualify = NULL, .preprocess = PreprocessDropIndexStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -564,6 +628,7 @@ static DistributeObjectOps Policy_Drop = { .qualify = NULL, .preprocess = PreprocessDropPolicyStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -572,6 +637,7 @@ static DistributeObjectOps Procedure_AlterObjectDepends = { .qualify = QualifyAlterFunctionDependsStmt, .preprocess = PreprocessAlterFunctionDependsStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionDependsStmtObjectAddress, .markDistributed = false, }; @@ -581,6 +647,7 @@ static DistributeObjectOps Procedure_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionSchemaStmtObjectAddress, .markDistributed = false, }; @@ -590,6 +657,7 @@ static DistributeObjectOps Procedure_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionOwnerObjectAddress, .markDistributed = false, }; @@ -598,6 +666,7 @@ static DistributeObjectOps Procedure_Drop = { .qualify = NULL, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -606,6 +675,7 @@ static DistributeObjectOps Procedure_Grant = { .qualify = NULL, .preprocess = PreprocessGrantOnFunctionStmt, .postprocess = PostprocessGrantOnFunctionStmt, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -615,6 +685,7 @@ static DistributeObjectOps Procedure_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = RenameFunctionStmtObjectAddress, .markDistributed = false, }; @@ -623,6 +694,7 @@ static DistributeObjectOps Routine_AlterObjectDepends = { .qualify = QualifyAlterFunctionDependsStmt, .preprocess = PreprocessAlterFunctionDependsStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionDependsStmtObjectAddress, .markDistributed = false, }; @@ -631,6 +703,7 @@ static DistributeObjectOps Sequence_Alter = { .qualify = NULL, .preprocess = PreprocessAlterSequenceStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = AlterSequenceStmtObjectAddress, .markDistributed = false, }; @@ -639,6 +712,7 @@ static DistributeObjectOps Sequence_AlterObjectSchema = { .qualify = QualifyAlterSequenceSchemaStmt, .preprocess = PreprocessAlterSequenceSchemaStmt, .postprocess = PostprocessAlterSequenceSchemaStmt, + .operationType = DIST_OPS_ALTER, .address = AlterSequenceSchemaStmtObjectAddress, .markDistributed = false, }; @@ -647,6 +721,7 @@ static DistributeObjectOps Sequence_AlterOwner = { .qualify = QualifyAlterSequenceOwnerStmt, .preprocess = PreprocessAlterSequenceOwnerStmt, .postprocess = PostprocessAlterSequenceOwnerStmt, + .operationType = DIST_OPS_ALTER, .address = AlterSequenceOwnerStmtObjectAddress, .markDistributed = false, }; @@ -655,6 +730,7 @@ static DistributeObjectOps Sequence_Drop = { .qualify = QualifyDropSequenceStmt, .preprocess = PreprocessDropSequenceStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = SequenceDropStmtObjectAddress, .markDistributed = false, }; @@ -663,6 +739,7 @@ static DistributeObjectOps Sequence_Grant = { .qualify = QualifyGrantOnSequenceStmt, .preprocess = PreprocessGrantOnSequenceStmt, .postprocess = PostprocessGrantOnSequenceStmt, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -671,6 +748,7 @@ static DistributeObjectOps Sequence_Rename = { .qualify = QualifyRenameSequenceStmt, .preprocess = PreprocessRenameSequenceStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = RenameSequenceStmtObjectAddress, .markDistributed = false, }; @@ -680,6 +758,7 @@ static DistributeObjectOps TextSearchConfig_Alter = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TSCONFIGURATION, + .operationType = DIST_OPS_ALTER, .address = AlterTextSearchConfigurationStmtObjectAddress, .markDistributed = false, }; @@ -689,6 +768,7 @@ static DistributeObjectOps TextSearchConfig_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_TSCONFIGURATION, + .operationType = DIST_OPS_ALTER, .address = AlterTextSearchConfigurationSchemaStmtObjectAddress, .markDistributed = false, }; @@ -698,6 +778,7 @@ static DistributeObjectOps TextSearchConfig_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_TSCONFIGURATION, + .operationType = DIST_OPS_ALTER, .address = AlterTextSearchConfigurationOwnerObjectAddress, .markDistributed = false, }; @@ -707,6 +788,7 @@ static DistributeObjectOps TextSearchConfig_Comment = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TSCONFIGURATION, + .operationType = DIST_OPS_ALTER, .address = TextSearchConfigurationCommentObjectAddress, .markDistributed = false, }; @@ -716,6 +798,7 @@ static DistributeObjectOps TextSearchConfig_Define = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_TSCONFIGURATION, + .operationType = DIST_OPS_CREATE, .address = CreateTextSearchConfigurationObjectAddress, .markDistributed = true, }; @@ -724,6 +807,7 @@ static DistributeObjectOps TextSearchConfig_Drop = { .qualify = QualifyDropTextSearchConfigurationStmt, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = DropTextSearchConfigObjectAddress, .markDistributed = false, }; @@ -733,6 +817,7 @@ static DistributeObjectOps TextSearchConfig_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TSCONFIGURATION, + .operationType = DIST_OPS_ALTER, .address = RenameTextSearchConfigurationStmtObjectAddress, .markDistributed = false, }; @@ -742,6 +827,7 @@ static DistributeObjectOps TextSearchDict_Alter = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TSDICTIONARY, + .operationType = DIST_OPS_ALTER, .address = AlterTextSearchDictionaryStmtObjectAddress, .markDistributed = false, }; @@ -751,6 +837,7 @@ static DistributeObjectOps TextSearchDict_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_TSDICTIONARY, + .operationType = DIST_OPS_ALTER, .address = AlterTextSearchDictionarySchemaStmtObjectAddress, .markDistributed = false, }; @@ -760,6 +847,7 @@ static DistributeObjectOps TextSearchDict_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_TSDICTIONARY, + .operationType = DIST_OPS_ALTER, .address = AlterTextSearchDictOwnerObjectAddress, .markDistributed = false, }; @@ -769,6 +857,7 @@ static DistributeObjectOps TextSearchDict_Comment = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TSDICTIONARY, + .operationType = DIST_OPS_ALTER, .address = TextSearchDictCommentObjectAddress, .markDistributed = false, }; @@ -778,6 +867,7 @@ static DistributeObjectOps TextSearchDict_Define = { .preprocess = NULL, .postprocess = PostprocessCreateDistributedObjectFromCatalogStmt, .objectType = OBJECT_TSDICTIONARY, + .operationType = DIST_OPS_CREATE, .address = CreateTextSearchDictObjectAddress, .markDistributed = true, }; @@ -786,6 +876,7 @@ static DistributeObjectOps TextSearchDict_Drop = { .qualify = QualifyDropTextSearchDictionaryStmt, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = DropTextSearchDictObjectAddress, .markDistributed = false, }; @@ -795,6 +886,7 @@ static DistributeObjectOps TextSearchDict_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TSDICTIONARY, + .operationType = DIST_OPS_ALTER, .address = RenameTextSearchDictionaryStmtObjectAddress, .markDistributed = false, }; @@ -803,6 +895,7 @@ static DistributeObjectOps Trigger_AlterObjectDepends = { .qualify = NULL, .preprocess = PreprocessAlterTriggerDependsStmt, .postprocess = PostprocessAlterTriggerDependsStmt, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -812,6 +905,7 @@ static DistributeObjectOps Routine_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionSchemaStmtObjectAddress, .markDistributed = false, }; @@ -821,6 +915,7 @@ static DistributeObjectOps Routine_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = AlterFunctionOwnerObjectAddress, .markDistributed = false, }; @@ -829,6 +924,7 @@ static DistributeObjectOps Routine_Drop = { .qualify = NULL, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -837,6 +933,7 @@ static DistributeObjectOps Routine_Grant = { .qualify = NULL, .preprocess = PreprocessGrantOnFunctionStmt, .postprocess = PostprocessGrantOnFunctionStmt, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -846,6 +943,7 @@ static DistributeObjectOps Routine_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_FUNCTION, + .operationType = DIST_OPS_ALTER, .address = RenameFunctionStmtObjectAddress, .markDistributed = false, }; @@ -854,6 +952,7 @@ static DistributeObjectOps Schema_Drop = { .qualify = NULL, .preprocess = PreprocessDropSchemaStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -862,6 +961,7 @@ static DistributeObjectOps Schema_Grant = { .qualify = NULL, .preprocess = PreprocessGrantOnSchemaStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -871,6 +971,7 @@ static DistributeObjectOps Schema_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_SCHEMA, + .operationType = DIST_OPS_ALTER, .address = AlterSchemaRenameStmtObjectAddress, .markDistributed = false, }; @@ -879,6 +980,7 @@ static DistributeObjectOps Statistics_Alter = { .qualify = QualifyAlterStatisticsStmt, .preprocess = PreprocessAlterStatisticsStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -887,6 +989,7 @@ static DistributeObjectOps Statistics_AlterObjectSchema = { .qualify = QualifyAlterStatisticsSchemaStmt, .preprocess = PreprocessAlterStatisticsSchemaStmt, .postprocess = PostprocessAlterStatisticsSchemaStmt, + .operationType = DIST_OPS_ALTER, .address = AlterStatisticsSchemaStmtObjectAddress, .markDistributed = false, }; @@ -894,6 +997,7 @@ static DistributeObjectOps Statistics_AlterOwner = { .deparse = DeparseAlterStatisticsOwnerStmt, .qualify = QualifyAlterStatisticsOwnerStmt, .preprocess = PreprocessAlterStatisticsOwnerStmt, + .operationType = DIST_OPS_ALTER, .postprocess = PostprocessAlterStatisticsOwnerStmt, .address = NULL, .markDistributed = false, @@ -903,6 +1007,7 @@ static DistributeObjectOps Statistics_Drop = { .qualify = QualifyDropStatisticsStmt, .preprocess = PreprocessDropStatisticsStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = DropStatisticsObjectAddress, .markDistributed = false, }; @@ -911,6 +1016,7 @@ static DistributeObjectOps Statistics_Rename = { .qualify = QualifyAlterStatisticsRenameStmt, .preprocess = PreprocessAlterStatisticsRenameStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -919,6 +1025,7 @@ static DistributeObjectOps Table_AlterTable = { .qualify = NULL, .preprocess = PreprocessAlterTableStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = NULL, .markDistributed = false, }; @@ -927,6 +1034,7 @@ static DistributeObjectOps Table_AlterObjectSchema = { .qualify = QualifyAlterTableSchemaStmt, .preprocess = PreprocessAlterTableSchemaStmt, .postprocess = PostprocessAlterTableSchemaStmt, + .operationType = DIST_OPS_ALTER, .address = AlterTableSchemaStmtObjectAddress, .markDistributed = false, }; @@ -935,6 +1043,7 @@ static DistributeObjectOps Table_Drop = { .qualify = NULL, .preprocess = PreprocessDropTableStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -944,6 +1053,7 @@ static DistributeObjectOps Type_AlterObjectSchema = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_TYPE, + .operationType = DIST_OPS_ALTER, .address = AlterTypeSchemaStmtObjectAddress, .markDistributed = false, }; @@ -960,6 +1070,7 @@ static DistributeObjectOps View_AlterObjectSchema = { .qualify = QualifyAlterViewSchemaStmt, .preprocess = PreprocessAlterViewSchemaStmt, .postprocess = PostprocessAlterViewSchemaStmt, + .operationType = DIST_OPS_ALTER, .address = AlterViewSchemaStmtObjectAddress, .markDistributed = false, }; @@ -969,6 +1080,7 @@ static DistributeObjectOps Type_AlterOwner = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = PostprocessAlterDistributedObjectStmt, .objectType = OBJECT_TYPE, + .operationType = DIST_OPS_ALTER, .address = AlterTypeOwnerObjectAddress, .markDistributed = false, }; @@ -978,6 +1090,7 @@ static DistributeObjectOps Type_AlterTable = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TYPE, + .operationType = DIST_OPS_ALTER, .address = AlterTypeStmtObjectAddress, .markDistributed = false, }; @@ -994,6 +1107,7 @@ static DistributeObjectOps View_AlterView = { .qualify = QualifyAlterViewStmt, .preprocess = PreprocessAlterViewStmt, .postprocess = PostprocessAlterViewStmt, + .operationType = DIST_OPS_ALTER, .address = AlterViewStmtObjectAddress, .markDistributed = false, }; @@ -1002,6 +1116,7 @@ static DistributeObjectOps Type_Drop = { .qualify = NULL, .preprocess = PreprocessDropDistributedObjectStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -1010,6 +1125,7 @@ static DistributeObjectOps Trigger_Drop = { .qualify = NULL, .preprocess = PreprocessDropTriggerStmt, .postprocess = NULL, + .operationType = DIST_OPS_DROP, .address = NULL, .markDistributed = false, }; @@ -1019,6 +1135,7 @@ static DistributeObjectOps Type_Rename = { .preprocess = PreprocessAlterDistributedObjectStmt, .postprocess = NULL, .objectType = OBJECT_TYPE, + .operationType = DIST_OPS_ALTER, .address = RenameTypeStmtObjectAddress, .markDistributed = false, }; @@ -1027,6 +1144,7 @@ static DistributeObjectOps Vacuum_Analyze = { .qualify = NULL, .preprocess = NULL, .postprocess = PostprocessVacuumStmt, + .operationType = DIST_OPS_NONE, .address = NULL, .markDistributed = false, }; @@ -1042,6 +1160,7 @@ static DistributeObjectOps View_Rename = { .qualify = QualifyRenameViewStmt, .preprocess = PreprocessRenameViewStmt, .postprocess = NULL, + .operationType = DIST_OPS_ALTER, .address = RenameViewStmtObjectAddress, .markDistributed = false, }; @@ -1049,6 +1168,7 @@ static DistributeObjectOps Trigger_Rename = { .deparse = NULL, .qualify = NULL, .preprocess = NULL, + .operationType = DIST_OPS_ALTER, .postprocess = PostprocessAlterTriggerRenameStmt, .address = NULL, .markDistributed = false, diff --git a/src/backend/distributed/commands/role.c b/src/backend/distributed/commands/role.c index dcec5c2cc..765fd50df 100644 --- a/src/backend/distributed/commands/role.c +++ b/src/backend/distributed/commands/role.c @@ -124,6 +124,13 @@ RoleSpecToObjectAddress(RoleSpec *role, bool missing_ok) Oid roleOid = get_rolespec_oid(role, missing_ok); ObjectAddressSet(*address, AuthIdRelationId, roleOid); } + else + { + /* + * If rolespec is null, role can be 'ALL'. We should be returning a pseudo-valid oid. + */ + ObjectAddressSet(*address, AuthIdRelationId, OID_MAX); + } return list_make1(address); } diff --git a/src/backend/distributed/commands/statistics.c b/src/backend/distributed/commands/statistics.c index a85d2db48..f6a9dc610 100644 --- a/src/backend/distributed/commands/statistics.c +++ b/src/backend/distributed/commands/statistics.c @@ -359,9 +359,19 @@ AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk) AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); ObjectAddress *address = palloc0(sizeof(ObjectAddress)); - String *statName = llast((List *) stmt->object); - Oid statsOid = get_statistics_object_oid(list_make2(makeString(stmt->newschema), - statName), missingOk); + List *statName = (List *) stmt->object; + Oid statsOid = get_statistics_object_oid(statName, true); + + if (statsOid == InvalidOid) + { + /* + * couldn't find the stat, might have already been moved to the new schema, we + * construct a new stat name that uses the new schema to search in. + */ + List *newStatName = list_make2(makeString(stmt->newschema), llast(statName)); + statsOid = get_statistics_object_oid(newStatName, missingOk); + } + ObjectAddressSet(*address, StatisticExtRelationId, statsOid); return list_make1(address); diff --git a/src/backend/distributed/commands/utility_hook.c b/src/backend/distributed/commands/utility_hook.c index 40b3e1c62..a6ae56afa 100644 --- a/src/backend/distributed/commands/utility_hook.c +++ b/src/backend/distributed/commands/utility_hook.c @@ -550,7 +550,10 @@ ProcessUtilityInternal(PlannedStmt *pstmt, * Therefore, we first check if all addresses in the given statement are valid. * Then, we do not execute qualify and preprocess if any address is invalid to * prevent before-mentioned citus related messages. PG will complain about the - * invalid address, so we are safe to not execute qualify and preprocess. + * invalid address, so we are safe to not execute qualify and preprocess. Also + * note that we should not guard any step after standardProcess_Utility with + * the flag distOpsHasInvalidObject because PG would have already failed the + * transaction. */ distOpsHasInvalidObject = DistOpsHasInvalidObject(parsetree, ops); diff --git a/src/backend/distributed/utils/citus_depended_object.c b/src/backend/distributed/utils/citus_depended_object.c index 9c0055b1f..07e004f1c 100644 --- a/src/backend/distributed/utils/citus_depended_object.c +++ b/src/backend/distributed/utils/citus_depended_object.c @@ -32,6 +32,7 @@ #include "catalog/pg_type.h" #include "distributed/citus_depended_object.h" #include "distributed/metadata_cache.h" +#include "distributed/commands.h" #include "distributed/listutils.h" #include "distributed/log_utils.h" #include "distributed/shared_library_init.h" @@ -48,6 +49,8 @@ bool HideCitusDependentObjects = false; static Node * CreateCitusDependentObjectExpr(int pgMetaTableVarno, int pgMetaTableOid); static List * GetCitusDependedObjectArgs(int pgMetaTableVarno, int pgMetaTableOid); +static bool StatementContainsIfExist(Node *node); +static bool AlterRoleSetStatementContainsAll(Node *node); /* * IsPgLocksTable returns true if RTE is pg_locks table. @@ -315,12 +318,26 @@ GetCitusDependedObjectArgs(int pgMetaTableVarno, int pgMetaTableOid) * is invalid; otherwise, returns false. If ops is null or it has no * implemented address method, we return false. * - * If EnableUnsupportedFeatureMessages is active, then we return false. + * We have some dist ops for which we should not validate. + * 1) We should not validate CREATE statements because no address exists + * here yet. + * 2) We should not validate '[DROP|ALTER] IF EXISTS' statements because it is ok + * by the semantics even if any object is invalid. + * 3) We should not validate 'ALTER ROLE ALL [SET|UNSET] because for the role ALL + * AlterRoleSetStmtObjectAddress returns an invalid address even though it should not. */ bool DistOpsHasInvalidObject(Node *node, const DistributeObjectOps *ops) { - if (EnableUnsupportedFeatureMessages) + if (ops && ops->operationType == DIST_OPS_CREATE) + { + return false; + } + else if (StatementContainsIfExist(node)) + { + return false; + } + else if (AlterRoleSetStatementContainsAll(node)) { return false; } @@ -340,3 +357,131 @@ DistOpsHasInvalidObject(Node *node, const DistributeObjectOps *ops) return false; } + + +/* + * StatementContainsIfExist returns true if the statement contains + * IF EXIST syntax. + */ +static bool +StatementContainsIfExist(Node *node) +{ + if (node == NULL) + { + return false; + } + + switch (nodeTag(node)) + { + case T_DropStmt: + { + DropStmt *dropStmt = castNode(DropStmt, node); + return dropStmt->missing_ok; + } + + case T_DropRoleStmt: + { + DropRoleStmt *dropRoleStmt = castNode(DropRoleStmt, node); + return dropRoleStmt->missing_ok; + } + + case T_DropdbStmt: + { + DropdbStmt *dropdbStmt = castNode(DropdbStmt, node); + return dropdbStmt->missing_ok; + } + + case T_DropTableSpaceStmt: + { + DropTableSpaceStmt *dropTableSpaceStmt = castNode(DropTableSpaceStmt, node); + return dropTableSpaceStmt->missing_ok; + } + + case T_DropUserMappingStmt: + { + DropUserMappingStmt *dropUserMappingStmt = castNode(DropUserMappingStmt, + node); + return dropUserMappingStmt->missing_ok; + } + + case T_DropSubscriptionStmt: + { + DropSubscriptionStmt *dropSubscriptionStmt = castNode(DropSubscriptionStmt, + node); + return dropSubscriptionStmt->missing_ok; + } + + case T_AlterTableStmt: + { + AlterTableStmt *alterTableStmt = castNode(AlterTableStmt, node); + return alterTableStmt->missing_ok; + } + + case T_AlterDomainStmt: + { + AlterDomainStmt *alterDomainStmt = castNode(AlterDomainStmt, node); + return alterDomainStmt->missing_ok; + } + + case T_AlterSeqStmt: + { + AlterSeqStmt *alterSeqStmt = castNode(AlterSeqStmt, node); + return alterSeqStmt->missing_ok; + } + + case T_AlterStatsStmt: + { + AlterStatsStmt *alterStatsStmt = castNode(AlterStatsStmt, node); + return alterStatsStmt->missing_ok; + } + + case T_RenameStmt: + { + RenameStmt *renameStmt = castNode(RenameStmt, node); + return renameStmt->missing_ok; + } + + case T_AlterObjectSchemaStmt: + { + AlterObjectSchemaStmt *alterObjectSchemaStmt = castNode(AlterObjectSchemaStmt, + node); + return alterObjectSchemaStmt->missing_ok; + } + + case T_AlterTSConfigurationStmt: + { + AlterTSConfigurationStmt *alterTSConfigurationStmt = castNode( + AlterTSConfigurationStmt, node); + return alterTSConfigurationStmt->missing_ok; + } + + default: + { + return false; + } + } +} + + +/* + * AlterRoleSetStatementContainsAll returns true if the statement is a + * ALTER ROLE ALL (SET / RESET). + */ +static bool +AlterRoleSetStatementContainsAll(Node *node) +{ + if (node == NULL) + { + return false; + } + + if (nodeTag(node) == T_AlterRoleSetStmt) + { + /* rolespec is null for the role 'ALL' */ + AlterRoleSetStmt *alterRoleSetStmt = castNode(AlterRoleSetStmt, node); + + return alterRoleSetStmt->role == NULL; + } + + return false; +} diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index f421a1255..ffd2782bb 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -39,6 +39,14 @@ extern void SwitchToSequentialAndLocalExecutionIfPartitionNameTooLong(Oid Oid partitionRelationId); +typedef enum DistOpsOperationType +{ + DIST_OPS_NONE, + DIST_OPS_CREATE, + DIST_OPS_ALTER, + DIST_OPS_DROP, +} DistOpsOperationType; + /* * DistributeObjectOps specifies handlers for node/object type pairs. @@ -74,6 +82,9 @@ typedef struct DistributeObjectOps * common propagation functions will not propagate the creation of the object. */ bool *featureFlag; + + /* specifies the type of the operation */ + DistOpsOperationType operationType; } DistributeObjectOps; #define CITUS_TRUNCATE_TRIGGER_NAME "citus_truncate_trigger"