From 7387c7ed3d198a2ea836b7b2547d6cff2f6834f0 Mon Sep 17 00:00:00 2001 From: aykutbozkurt Date: Tue, 2 Aug 2022 13:06:54 +0300 Subject: [PATCH] address method should take parameter isPostprocess --- src/backend/distributed/commands/collation.c | 8 +- src/backend/distributed/commands/common.c | 10 +- src/backend/distributed/commands/database.c | 2 +- src/backend/distributed/commands/domain.c | 10 +- src/backend/distributed/commands/extension.c | 8 +- .../distributed/commands/foreign_server.c | 8 +- src/backend/distributed/commands/function.c | 21 +- src/backend/distributed/commands/index.c | 2 +- src/backend/distributed/commands/role.c | 17 +- src/backend/distributed/commands/schema.c | 4 +- src/backend/distributed/commands/sequence.c | 24 +-- src/backend/distributed/commands/statistics.c | 28 ++- src/backend/distributed/commands/table.c | 6 +- .../distributed/commands/text_search.c | 33 ++-- src/backend/distributed/commands/trigger.c | 4 +- src/backend/distributed/commands/type.c | 16 +- .../distributed/commands/utility_hook.c | 6 +- src/backend/distributed/commands/view.c | 22 +-- .../distributed/deparser/objectaddress.c | 8 +- .../distributed/utils/citus_depended_object.c | 28 ++- .../worker/worker_create_or_replace.c | 2 +- src/include/distributed/commands.h | 180 +++++++++++------- src/include/distributed/deparser.h | 6 +- 23 files changed, 260 insertions(+), 193 deletions(-) diff --git a/src/backend/distributed/commands/collation.c b/src/backend/distributed/commands/collation.c index 834e847a1..8904ab674 100644 --- a/src/backend/distributed/commands/collation.c +++ b/src/backend/distributed/commands/collation.c @@ -170,7 +170,7 @@ CreateCollationDDLsIdempotent(Oid collationId) List * -AlterCollationOwnerObjectAddress(Node *node, bool missing_ok) +AlterCollationOwnerObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Relation relation; @@ -192,7 +192,7 @@ AlterCollationOwnerObjectAddress(Node *node, bool missing_ok) * of the RenameStmt. Errors if missing_ok is false. */ List * -RenameCollationStmtObjectAddress(Node *node, bool missing_ok) +RenameCollationStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_COLLATION); @@ -215,7 +215,7 @@ RenameCollationStmtObjectAddress(Node *node, bool missing_ok) * schemas. */ List * -AlterCollationSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterCollationSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_COLLATION); @@ -297,7 +297,7 @@ GenerateBackupNameForCollationCollision(const ObjectAddress *address) List * -DefineCollationStmtObjectAddress(Node *node, bool missing_ok) +DefineCollationStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { DefineStmt *stmt = castNode(DefineStmt, node); Assert(stmt->kind == OBJECT_COLLATION); diff --git a/src/backend/distributed/commands/common.c b/src/backend/distributed/commands/common.c index 0441abe05..797981d47 100644 --- a/src/backend/distributed/commands/common.c +++ b/src/backend/distributed/commands/common.c @@ -63,7 +63,7 @@ PostprocessCreateDistributedObjectFromCatalogStmt(Node *stmt, const char *queryS return NIL; } - List *addresses = GetObjectAddressListFromParseTree(stmt, false); + List *addresses = GetObjectAddressListFromParseTree(stmt, false, true); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -121,7 +121,7 @@ PreprocessAlterDistributedObjectStmt(Node *stmt, const char *queryString, const DistributeObjectOps *ops = GetDistributeObjectOps(stmt); Assert(ops != NULL); - List *addresses = GetObjectAddressListFromParseTree(stmt, false); + List *addresses = GetObjectAddressListFromParseTree(stmt, false, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -170,7 +170,7 @@ PostprocessAlterDistributedObjectStmt(Node *stmt, const char *queryString) const DistributeObjectOps *ops = GetDistributeObjectOps(stmt); Assert(ops != NULL); - List *addresses = GetObjectAddressListFromParseTree(stmt, false); + List *addresses = GetObjectAddressListFromParseTree(stmt, false, true); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -296,7 +296,7 @@ PreprocessDropDistributedObjectStmt(Node *node, const char *queryString, * the drop tsdict statement. */ List * -DropTextSearchDictObjectAddress(Node *node, bool missing_ok) +DropTextSearchDictObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { DropStmt *stmt = castNode(DropStmt, node); @@ -321,7 +321,7 @@ DropTextSearchDictObjectAddress(Node *node, bool missing_ok) * the drop tsconfig statement. */ List * -DropTextSearchConfigObjectAddress(Node *node, bool missing_ok) +DropTextSearchConfigObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { DropStmt *stmt = castNode(DropStmt, node); diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index 2bd03d5d8..208d570eb 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -41,7 +41,7 @@ bool EnableAlterDatabaseOwner = true; * object of the AlterOwnerStmt. Errors if missing_ok is false. */ List * -AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok) +AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Assert(stmt->objectType == OBJECT_DATABASE); diff --git a/src/backend/distributed/commands/domain.c b/src/backend/distributed/commands/domain.c index 50d195d58..6c1bea4fd 100644 --- a/src/backend/distributed/commands/domain.c +++ b/src/backend/distributed/commands/domain.c @@ -230,7 +230,7 @@ MakeCollateClauseFromOid(Oid collationOid) * the domain cannot be found in the local catalog. */ List * -CreateDomainStmtObjectAddress(Node *node, bool missing_ok) +CreateDomainStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CreateDomainStmt *stmt = castNode(CreateDomainStmt, node); @@ -249,7 +249,7 @@ CreateDomainStmtObjectAddress(Node *node, bool missing_ok) * found. */ List * -AlterDomainStmtObjectAddress(Node *node, bool missing_ok) +AlterDomainStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterDomainStmt *stmt = castNode(AlterDomainStmt, node); @@ -264,7 +264,7 @@ AlterDomainStmtObjectAddress(Node *node, bool missing_ok) * error if the domain cannot be found. */ List * -DomainRenameConstraintStmtObjectAddress(Node *node, bool missing_ok) +DomainRenameConstraintStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -279,7 +279,7 @@ DomainRenameConstraintStmtObjectAddress(Node *node, bool missing_ok) * cannot be found. */ List * -AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok) +AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Assert(stmt->objectType == OBJECT_DOMAIN); @@ -295,7 +295,7 @@ AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok) * found. */ List * -RenameDomainStmtObjectAddress(Node *node, bool missing_ok) +RenameDomainStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_DOMAIN); diff --git a/src/backend/distributed/commands/extension.c b/src/backend/distributed/commands/extension.c index 122c68dfa..542a41c10 100644 --- a/src/backend/distributed/commands/extension.c +++ b/src/backend/distributed/commands/extension.c @@ -181,7 +181,7 @@ PostprocessCreateExtensionStmt(Node *node, const char *queryString) (void *) createExtensionStmtSql, ENABLE_DDL_PROPAGATION); - List *extensionAddresses = GetObjectAddressListFromParseTree(node, false); + List *extensionAddresses = GetObjectAddressListFromParseTree(node, false, true); /* the code-path only supports a single object */ Assert(list_length(extensionAddresses) == 1); @@ -413,7 +413,7 @@ PreprocessAlterExtensionSchemaStmt(Node *node, const char *queryString, List * PostprocessAlterExtensionSchemaStmt(Node *node, const char *queryString) { - List *extensionAddresses = GetObjectAddressListFromParseTree(node, false); + List *extensionAddresses = GetObjectAddressListFromParseTree(node, false, true); /* the code-path only supports a single object */ Assert(list_length(extensionAddresses) == 1); @@ -1134,7 +1134,7 @@ GetDependentFDWsToExtension(Oid extensionId) * the subject of the AlterObjectSchemaStmt. Errors if missing_ok is false. */ List * -AlterExtensionSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterExtensionSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_EXTENSION); @@ -1162,7 +1162,7 @@ AlterExtensionSchemaStmtObjectAddress(Node *node, bool missing_ok) * the subject of the AlterExtensionStmt. Errors if missing_ok is false. */ List * -AlterExtensionUpdateStmtObjectAddress(Node *node, bool missing_ok) +AlterExtensionUpdateStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterExtensionStmt *stmt = castNode(AlterExtensionStmt, node); const char *extensionName = stmt->extname; diff --git a/src/backend/distributed/commands/foreign_server.c b/src/backend/distributed/commands/foreign_server.c index b8fcf0412..7d19f9336 100644 --- a/src/backend/distributed/commands/foreign_server.c +++ b/src/backend/distributed/commands/foreign_server.c @@ -42,7 +42,7 @@ static List * GetObjectAddressByServerName(char *serverName, bool missing_ok); * was set to true. */ List * -CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok) +CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CreateForeignServerStmt *stmt = castNode(CreateForeignServerStmt, node); @@ -59,7 +59,7 @@ CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok) * was set to true. */ List * -AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok) +AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterForeignServerStmt *stmt = castNode(AlterForeignServerStmt, node); @@ -124,7 +124,7 @@ PreprocessGrantOnForeignServerStmt(Node *node, const char *queryString, * was set to true. */ List * -RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok) +RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_FOREIGN_SERVER); @@ -142,7 +142,7 @@ RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok) * was set to true. */ List * -AlterForeignServerOwnerStmtObjectAddress(Node *node, bool missing_ok) +AlterForeignServerOwnerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); char *serverName = strVal(stmt->object); diff --git a/src/backend/distributed/commands/function.c b/src/backend/distributed/commands/function.c index 318f6242f..d04728252 100644 --- a/src/backend/distributed/commands/function.c +++ b/src/backend/distributed/commands/function.c @@ -1372,7 +1372,8 @@ PostprocessCreateFunctionStmt(Node *node, const char *queryString) return NIL; } - List *functionAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false); + List *functionAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false, + true); /* the code-path only supports a single object */ Assert(list_length(functionAddresses) == 1); @@ -1416,7 +1417,7 @@ PostprocessCreateFunctionStmt(Node *node, const char *queryString) * normal postgres error for unfound functions. */ List * -CreateFunctionStmtObjectAddress(Node *node, bool missing_ok) +CreateFunctionStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CreateFunctionStmt *stmt = castNode(CreateFunctionStmt, node); ObjectType objectType = OBJECT_FUNCTION; @@ -1461,7 +1462,7 @@ CreateFunctionStmtObjectAddress(Node *node, bool missing_ok) * objectId in the address can be invalid if missing_ok was set to true. */ List * -DefineAggregateStmtObjectAddress(Node *node, bool missing_ok) +DefineAggregateStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { DefineStmt *stmt = castNode(DefineStmt, node); @@ -1514,7 +1515,7 @@ PreprocessAlterFunctionStmt(Node *node, const char *queryString, AlterFunctionStmt *stmt = castNode(AlterFunctionStmt, node); AssertObjectTypeIsFunctional(stmt->objtype); - List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, false); + List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, false, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -1576,7 +1577,7 @@ PreprocessAlterFunctionDependsStmt(Node *node, const char *queryString, return NIL; } - List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, true); + List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, true, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -1610,7 +1611,7 @@ PreprocessAlterFunctionDependsStmt(Node *node, const char *queryString, * missing_ok is set to false the lookup will raise an error. */ List * -AlterFunctionDependsStmtObjectAddress(Node *node, bool missing_ok) +AlterFunctionDependsStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectDependsStmt *stmt = castNode(AlterObjectDependsStmt, node); AssertObjectTypeIsFunctional(stmt->objectType); @@ -1626,7 +1627,7 @@ AlterFunctionDependsStmtObjectAddress(Node *node, bool missing_ok) * was unable to find the function/procedure that was the target of the statement. */ List * -AlterFunctionStmtObjectAddress(Node *node, bool missing_ok) +AlterFunctionStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterFunctionStmt *stmt = castNode(AlterFunctionStmt, node); return FunctionToObjectAddress(stmt->objtype, stmt->func, missing_ok); @@ -1638,7 +1639,7 @@ AlterFunctionStmtObjectAddress(Node *node, bool missing_ok) * subject of the RenameStmt. Errors if missing_ok is false. */ List * -RenameFunctionStmtObjectAddress(Node *node, bool missing_ok) +RenameFunctionStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); return FunctionToObjectAddress(stmt->renameType, @@ -1651,7 +1652,7 @@ RenameFunctionStmtObjectAddress(Node *node, bool missing_ok) * subject of the AlterOwnerStmt. Errors if missing_ok is false. */ List * -AlterFunctionOwnerObjectAddress(Node *node, bool missing_ok) +AlterFunctionOwnerObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); return FunctionToObjectAddress(stmt->objectType, @@ -1669,7 +1670,7 @@ AlterFunctionOwnerObjectAddress(Node *node, bool missing_ok) * the schemas. */ List * -AlterFunctionSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterFunctionSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); AssertObjectTypeIsFunctional(stmt->objectType); diff --git a/src/backend/distributed/commands/index.c b/src/backend/distributed/commands/index.c index 8fef77dc0..008f4fa90 100644 --- a/src/backend/distributed/commands/index.c +++ b/src/backend/distributed/commands/index.c @@ -658,7 +658,7 @@ PreprocessReindexStmt(Node *node, const char *reindexCommand, * else, we add invalid address. */ List * -ReindexStmtObjectAddress(Node *stmt, bool missing_ok) +ReindexStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess) { ReindexStmt *reindexStatement = castNode(ReindexStmt, stmt); diff --git a/src/backend/distributed/commands/role.c b/src/backend/distributed/commands/role.c index 765fd50df..74d14751e 100644 --- a/src/backend/distributed/commands/role.c +++ b/src/backend/distributed/commands/role.c @@ -88,7 +88,7 @@ bool EnableAlterRoleSetPropagation = true; * was unable to find the role that was the target of the statement. */ List * -AlterRoleStmtObjectAddress(Node *node, bool missing_ok) +AlterRoleStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterRoleStmt *stmt = castNode(AlterRoleStmt, node); return RoleSpecToObjectAddress(stmt->role, missing_ok); @@ -101,7 +101,7 @@ AlterRoleStmtObjectAddress(Node *node, bool missing_ok) * was unable to find the role that was the target of the statement. */ List * -AlterRoleSetStmtObjectAddress(Node *node, bool missing_ok) +AlterRoleSetStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterRoleSetStmt *stmt = castNode(AlterRoleSetStmt, node); return RoleSpecToObjectAddress(stmt->role, missing_ok); @@ -124,13 +124,6 @@ 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); } @@ -144,7 +137,7 @@ RoleSpecToObjectAddress(RoleSpec *role, bool missing_ok) List * PostprocessAlterRoleStmt(Node *node, const char *queryString) { - List *addresses = GetObjectAddressListFromParseTree(node, false); + List *addresses = GetObjectAddressListFromParseTree(node, false, true); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -219,7 +212,7 @@ PreprocessAlterRoleSetStmt(Node *node, const char *queryString, return NIL; } - List *addresses = GetObjectAddressListFromParseTree(node, false); + List *addresses = GetObjectAddressListFromParseTree(node, false, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -1195,7 +1188,7 @@ ConfigGenericNameCompare(const void *a, const void *b) * to true. */ List * -CreateRoleStmtObjectAddress(Node *node, bool missing_ok) +CreateRoleStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CreateRoleStmt *stmt = castNode(CreateRoleStmt, node); Oid roleOid = get_role_oid(stmt->role, missing_ok); diff --git a/src/backend/distributed/commands/schema.c b/src/backend/distributed/commands/schema.c index 571064130..3a5ee5bde 100644 --- a/src/backend/distributed/commands/schema.c +++ b/src/backend/distributed/commands/schema.c @@ -184,7 +184,7 @@ PreprocessGrantOnSchemaStmt(Node *node, const char *queryString, * the object of the CreateSchemaStmt. Errors if missing_ok is false. */ List * -CreateSchemaStmtObjectAddress(Node *node, bool missing_ok) +CreateSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CreateSchemaStmt *stmt = castNode(CreateSchemaStmt, node); @@ -214,7 +214,7 @@ CreateSchemaStmtObjectAddress(Node *node, bool missing_ok) * the object of the RenameStmt. Errors if missing_ok is false. */ List * -AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok) +AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_SCHEMA); diff --git a/src/backend/distributed/commands/sequence.c b/src/backend/distributed/commands/sequence.c index a5311c714..99faad4a8 100644 --- a/src/backend/distributed/commands/sequence.c +++ b/src/backend/distributed/commands/sequence.c @@ -318,7 +318,7 @@ PreprocessDropSequenceStmt(Node *node, const char *queryString, * statement. */ List * -SequenceDropStmtObjectAddress(Node *stmt, bool missing_ok) +SequenceDropStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess) { DropStmt *dropSeqStmt = castNode(DropStmt, stmt); @@ -357,7 +357,7 @@ PreprocessRenameSequenceStmt(Node *node, const char *queryString, ProcessUtility Assert(stmt->renameType == OBJECT_SEQUENCE); List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, - stmt->missing_ok); + stmt->missing_ok, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -384,7 +384,7 @@ PreprocessRenameSequenceStmt(Node *node, const char *queryString, ProcessUtility * subject of the RenameStmt. */ List * -RenameSequenceStmtObjectAddress(Node *node, bool missing_ok) +RenameSequenceStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_SEQUENCE); @@ -421,7 +421,7 @@ PreprocessAlterSequenceStmt(Node *node, const char *queryString, AlterSeqStmt *stmt = castNode(AlterSeqStmt, node); List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, - stmt->missing_ok); + stmt->missing_ok, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -504,7 +504,7 @@ SequenceUsedInDistributedTable(const ObjectAddress *sequenceAddress) * subject of the AlterSeqStmt. */ List * -AlterSequenceStmtObjectAddress(Node *node, bool missing_ok) +AlterSequenceStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterSeqStmt *stmt = castNode(AlterSeqStmt, node); @@ -531,7 +531,7 @@ PreprocessAlterSequenceSchemaStmt(Node *node, const char *queryString, Assert(stmt->objectType == OBJECT_SEQUENCE); List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, - stmt->missing_ok); + stmt->missing_ok, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -558,7 +558,7 @@ PreprocessAlterSequenceSchemaStmt(Node *node, const char *queryString, * the subject of the AlterObjectSchemaStmt. */ List * -AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_SEQUENCE); @@ -609,7 +609,7 @@ PostprocessAlterSequenceSchemaStmt(Node *node, const char *queryString) AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_SEQUENCE); List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, - stmt->missing_ok); + stmt->missing_ok, true); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -640,7 +640,8 @@ PreprocessAlterSequenceOwnerStmt(Node *node, const char *queryString, AlterTableStmt *stmt = castNode(AlterTableStmt, node); Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE); - List *sequenceAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false); + List *sequenceAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false, + false); /* the code-path only supports a single object */ Assert(list_length(sequenceAddresses) == 1); @@ -667,7 +668,7 @@ PreprocessAlterSequenceOwnerStmt(Node *node, const char *queryString, * subject of the AlterOwnerStmt. */ List * -AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok) +AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterTableStmt *stmt = castNode(AlterTableStmt, node); Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE); @@ -692,7 +693,8 @@ PostprocessAlterSequenceOwnerStmt(Node *node, const char *queryString) AlterTableStmt *stmt = castNode(AlterTableStmt, node); Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_SEQUENCE); - List *sequenceAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false); + List *sequenceAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false, + true); /* the code-path only supports a single object */ Assert(list_length(sequenceAddresses) == 1); diff --git a/src/backend/distributed/commands/statistics.c b/src/backend/distributed/commands/statistics.c index f6a9dc610..a65d6c0fe 100644 --- a/src/backend/distributed/commands/statistics.c +++ b/src/backend/distributed/commands/statistics.c @@ -120,7 +120,8 @@ PostprocessCreateStatisticsStmt(Node *node, const char *queryString) } bool missingOk = false; - List *objectAddresses = GetObjectAddressListFromParseTree((Node *) stmt, missingOk); + List *objectAddresses = GetObjectAddressListFromParseTree((Node *) stmt, missingOk, + true); /* the code-path only supports a single object */ Assert(list_length(objectAddresses) == 1); @@ -140,7 +141,7 @@ PostprocessCreateStatisticsStmt(Node *node, const char *queryString) * was set to true. */ List * -CreateStatisticsStmtObjectAddress(Node *node, bool missingOk) +CreateStatisticsStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess) { CreateStatsStmt *stmt = castNode(CreateStatsStmt, node); @@ -215,7 +216,7 @@ PreprocessDropStatisticsStmt(Node *node, const char *queryString, * statement. */ List * -DropStatisticsObjectAddress(Node *node, bool missing_ok) +DropStatisticsObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { DropStmt *dropStatisticsStmt = castNode(DropStmt, node); Assert(dropStatisticsStmt->removeType == OBJECT_STATISTIC_EXT); @@ -334,7 +335,8 @@ PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString) } bool missingOk = false; - List *objectAddresses = GetObjectAddressListFromParseTree((Node *) stmt, missingOk); + List *objectAddresses = GetObjectAddressListFromParseTree((Node *) stmt, missingOk, + true); /* the code-path only supports a single object */ Assert(list_length(objectAddresses) == 1); @@ -354,23 +356,29 @@ PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString) * was set to true. */ List * -AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk) +AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); ObjectAddress *address = palloc0(sizeof(ObjectAddress)); - List *statName = (List *) stmt->object; - Oid statsOid = get_statistics_object_oid(statName, true); + Oid statsOid = InvalidOid; - if (statsOid == InvalidOid) + List *statName = (List *) stmt->object; + + if (isPostprocess) { /* - * 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. + * we should search the object in the new schema because the method is + * called during postprocess, standard_utility should have already moved + * the stat into new schema. */ List *newStatName = list_make2(makeString(stmt->newschema), llast(statName)); statsOid = get_statistics_object_oid(newStatName, missingOk); } + else + { + statsOid = get_statistics_object_oid(statName, missingOk); + } ObjectAddressSet(*address, StatisticExtRelationId, statsOid); diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index a1f9a685e..d8fb4f59d 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -649,7 +649,7 @@ PostprocessAlterTableSchemaStmt(Node *node, const char *queryString) /* * We will let Postgres deal with missing_ok */ - List *tableAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true); + List *tableAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true, true); /* the code-path only supports a single object */ Assert(list_length(tableAddresses) == 1); @@ -1786,7 +1786,7 @@ PreprocessAlterTableSchemaStmt(Node *node, const char *queryString, } List *addresses = GetObjectAddressListFromParseTree((Node *) stmt, - stmt->missing_ok); + stmt->missing_ok, false); /* the code-path only supports a single object */ Assert(list_length(addresses) == 1); @@ -3369,7 +3369,7 @@ ErrorIfUnsupportedAlterAddConstraintStmt(AlterTableStmt *alterTableStatement) * be found in either of the schemas. */ List * -AlterTableSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterTableSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_TABLE || stmt->objectType == OBJECT_FOREIGN_TABLE); diff --git a/src/backend/distributed/commands/text_search.c b/src/backend/distributed/commands/text_search.c index 22ff5df2f..54dfdae85 100644 --- a/src/backend/distributed/commands/text_search.c +++ b/src/backend/distributed/commands/text_search.c @@ -570,7 +570,8 @@ get_ts_parser_namelist(Oid tsparserOid) * the text search configuration described in the statement doesn't exist. */ List * -CreateTextSearchConfigurationObjectAddress(Node *node, bool missing_ok) +CreateTextSearchConfigurationObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { DefineStmt *stmt = castNode(DefineStmt, node); Assert(stmt->kind == OBJECT_TSCONFIGURATION); @@ -589,7 +590,7 @@ CreateTextSearchConfigurationObjectAddress(Node *node, bool missing_ok) * the text search dictionary described in the statement doesn't exist. */ List * -CreateTextSearchDictObjectAddress(Node *node, bool missing_ok) +CreateTextSearchDictObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { DefineStmt *stmt = castNode(DefineStmt, node); Assert(stmt->kind == OBJECT_TSDICTIONARY); @@ -608,7 +609,8 @@ CreateTextSearchDictObjectAddress(Node *node, bool missing_ok) * exist based on the missing_ok flag passed in by the caller. */ List * -RenameTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) +RenameTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_TSCONFIGURATION); @@ -627,7 +629,8 @@ RenameTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) * exist based on the missing_ok flag passed in by the caller. */ List * -RenameTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) +RenameTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_TSDICTIONARY); @@ -646,7 +649,8 @@ RenameTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) * exist based on the missing_ok flag passed in by the caller. */ List * -AlterTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) +AlterTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { AlterTSConfigurationStmt *stmt = castNode(AlterTSConfigurationStmt, node); @@ -664,7 +668,8 @@ AlterTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) * exist based on the missing_ok flag passed in by the caller. */ List * -AlterTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) +AlterTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { AlterTSDictionaryStmt *stmt = castNode(AlterTSDictionaryStmt, node); @@ -686,7 +691,8 @@ AlterTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) * in edgecases will be raised by postgres while executing the move. */ List * -AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_TSCONFIGURATION); @@ -739,7 +745,8 @@ AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, bool missing_ok) * in edgecases will be raised by postgres while executing the move. */ List * -AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_TSDICTIONARY); @@ -788,7 +795,8 @@ AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, bool missing_ok) * configuration does not exist based on the missing_ok flag passed in by the caller. */ List * -TextSearchConfigurationCommentObjectAddress(Node *node, bool missing_ok) +TextSearchConfigurationCommentObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { CommentStmt *stmt = castNode(CommentStmt, node); Assert(stmt->objtype == OBJECT_TSCONFIGURATION); @@ -807,7 +815,7 @@ TextSearchConfigurationCommentObjectAddress(Node *node, bool missing_ok) * exist based on the missing_ok flag passed in by the caller. */ List * -TextSearchDictCommentObjectAddress(Node *node, bool missing_ok) +TextSearchDictCommentObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CommentStmt *stmt = castNode(CommentStmt, node); Assert(stmt->objtype == OBJECT_TSDICTIONARY); @@ -826,7 +834,8 @@ TextSearchDictCommentObjectAddress(Node *node, bool missing_ok) * configuration does not exist based on the missing_ok flag passed in by the caller. */ List * -AlterTextSearchConfigurationOwnerObjectAddress(Node *node, bool missing_ok) +AlterTextSearchConfigurationOwnerObjectAddress(Node *node, bool missing_ok, bool + isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Relation relation = NULL; @@ -850,7 +859,7 @@ AlterTextSearchConfigurationOwnerObjectAddress(Node *node, bool missing_ok) * configuration does not exist based on the missing_ok flag passed in by the caller. */ List * -AlterTextSearchDictOwnerObjectAddress(Node *node, bool missing_ok) +AlterTextSearchDictOwnerObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Relation relation = NULL; diff --git a/src/backend/distributed/commands/trigger.c b/src/backend/distributed/commands/trigger.c index 9d9d62342..299ffcc32 100644 --- a/src/backend/distributed/commands/trigger.c +++ b/src/backend/distributed/commands/trigger.c @@ -224,7 +224,7 @@ PostprocessCreateTriggerStmt(Node *node, const char *queryString) EnsureCoordinator(); ErrorOutForTriggerIfNotSupported(relationId); - List *objectAddresses = GetObjectAddressListFromParseTree(node, missingOk); + List *objectAddresses = GetObjectAddressListFromParseTree(node, missingOk, true); /* the code-path only supports a single object */ Assert(list_length(objectAddresses) == 1); @@ -246,7 +246,7 @@ PostprocessCreateTriggerStmt(Node *node, const char *queryString) * was set to true. */ List * -CreateTriggerStmtObjectAddress(Node *node, bool missingOk) +CreateTriggerStmtObjectAddress(Node *node, bool missingOk, bool isPostprocess) { CreateTrigStmt *createTriggerStmt = castNode(CreateTrigStmt, node); diff --git a/src/backend/distributed/commands/type.c b/src/backend/distributed/commands/type.c index 3a10ab6a0..3e641fad0 100644 --- a/src/backend/distributed/commands/type.c +++ b/src/backend/distributed/commands/type.c @@ -117,7 +117,7 @@ PreprocessRenameTypeAttributeStmt(Node *node, const char *queryString, Assert(stmt->renameType == OBJECT_ATTRIBUTE); Assert(stmt->relationType == OBJECT_TYPE); - List *typeAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false); + List *typeAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false, false); /* the code-path only supports a single object */ Assert(list_length(typeAddresses) == 1); @@ -305,7 +305,7 @@ EnumValsList(Oid typeOid) * to true. */ List * -CompositeTypeStmtObjectAddress(Node *node, bool missing_ok) +CompositeTypeStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CompositeTypeStmt *stmt = castNode(CompositeTypeStmt, node); TypeName *typeName = MakeTypeNameFromRangeVar(stmt->typevar); @@ -326,7 +326,7 @@ CompositeTypeStmtObjectAddress(Node *node, bool missing_ok) * to true. */ List * -CreateEnumStmtObjectAddress(Node *node, bool missing_ok) +CreateEnumStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CreateEnumStmt *stmt = castNode(CreateEnumStmt, node); TypeName *typeName = makeTypeNameFromNameList(stmt->typeName); @@ -347,7 +347,7 @@ CreateEnumStmtObjectAddress(Node *node, bool missing_ok) * to true. */ List * -AlterTypeStmtObjectAddress(Node *node, bool missing_ok) +AlterTypeStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterTableStmt *stmt = castNode(AlterTableStmt, node); Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_TYPE); @@ -366,7 +366,7 @@ AlterTypeStmtObjectAddress(Node *node, bool missing_ok) * object of the AlterEnumStmt. Errors is missing_ok is false. */ List * -AlterEnumStmtObjectAddress(Node *node, bool missing_ok) +AlterEnumStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterEnumStmt *stmt = castNode(AlterEnumStmt, node); TypeName *typeName = makeTypeNameFromNameList(stmt->typeName); @@ -383,7 +383,7 @@ AlterEnumStmtObjectAddress(Node *node, bool missing_ok) * of the RenameStmt. Errors if missing_ok is false. */ List * -RenameTypeStmtObjectAddress(Node *node, bool missing_ok) +RenameTypeStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_TYPE); @@ -407,7 +407,7 @@ RenameTypeStmtObjectAddress(Node *node, bool missing_ok) * schemas. */ List * -AlterTypeSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterTypeSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); Assert(stmt->objectType == OBJECT_TYPE || stmt->objectType == OBJECT_DOMAIN); @@ -487,7 +487,7 @@ RenameTypeAttributeStmtObjectAddress(Node *node, bool missing_ok) * of the AlterOwnerStmt. Errors if missing_ok is false. */ List * -AlterTypeOwnerObjectAddress(Node *node, bool missing_ok) +AlterTypeOwnerObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Assert(stmt->objectType == OBJECT_TYPE); diff --git a/src/backend/distributed/commands/utility_hook.c b/src/backend/distributed/commands/utility_hook.c index a6ae56afa..38ff4a379 100644 --- a/src/backend/distributed/commands/utility_hook.c +++ b/src/backend/distributed/commands/utility_hook.c @@ -552,8 +552,8 @@ ProcessUtilityInternal(PlannedStmt *pstmt, * prevent before-mentioned citus related messages. PG will complain about the * 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. + * the flag distOpsHasInvalidObject because PG would have already failed the + * transaction. */ distOpsHasInvalidObject = DistOpsHasInvalidObject(parsetree, ops); @@ -872,7 +872,7 @@ ProcessUtilityInternal(PlannedStmt *pstmt, */ if (ops && ops->markDistributed) { - List *addresses = GetObjectAddressListFromParseTree(parsetree, false); + List *addresses = GetObjectAddressListFromParseTree(parsetree, false, true); ObjectAddress *address = NULL; foreach_ptr(address, addresses) { diff --git a/src/backend/distributed/commands/view.c b/src/backend/distributed/commands/view.c index ce7119875..8fc9c7dc0 100644 --- a/src/backend/distributed/commands/view.c +++ b/src/backend/distributed/commands/view.c @@ -94,7 +94,7 @@ PostprocessViewStmt(Node *node, const char *queryString) return NIL; } - List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false); + List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, false, true); /* the code-path only supports a single object */ Assert(list_length(viewAddresses) == 1); @@ -158,7 +158,7 @@ PostprocessViewStmt(Node *node, const char *queryString) * CREATE [OR REPLACE] VIEW statement. */ List * -ViewStmtObjectAddress(Node *node, bool missing_ok) +ViewStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { ViewStmt *stmt = castNode(ViewStmt, node); @@ -226,7 +226,7 @@ PreprocessDropViewStmt(Node *node, const char *queryString, ProcessUtilityContex * statement. */ List * -DropViewStmtObjectAddress(Node *stmt, bool missing_ok) +DropViewStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess) { DropStmt *dropStmt = castNode(DropStmt, stmt); @@ -489,7 +489,7 @@ PreprocessAlterViewStmt(Node *node, const char *queryString, ProcessUtilityConte { AlterTableStmt *stmt = castNode(AlterTableStmt, node); - List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true); + List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true, false); /* the code-path only supports a single object */ Assert(list_length(viewAddresses) == 1); @@ -531,7 +531,7 @@ PostprocessAlterViewStmt(Node *node, const char *queryString) AlterTableStmt *stmt = castNode(AlterTableStmt, node); Assert(AlterTableStmtObjType_compat(stmt) == OBJECT_VIEW); - List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true); + List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true, true); /* the code-path only supports a single object */ Assert(list_length(viewAddresses) == 1); @@ -563,7 +563,7 @@ PostprocessAlterViewStmt(Node *node, const char *queryString) * ALTER VIEW statement. */ List * -AlterViewStmtObjectAddress(Node *node, bool missing_ok) +AlterViewStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterTableStmt *stmt = castNode(AlterTableStmt, node); Oid viewOid = RangeVarGetRelid(stmt->relation, NoLock, missing_ok); @@ -583,7 +583,7 @@ List * PreprocessRenameViewStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext) { - List *viewAddresses = GetObjectAddressListFromParseTree(node, true); + List *viewAddresses = GetObjectAddressListFromParseTree(node, true, false); /* the code-path only supports a single object */ Assert(list_length(viewAddresses) == 1); @@ -622,7 +622,7 @@ PreprocessRenameViewStmt(Node *node, const char *queryString, * of the RenameStmt. Errors if missing_ok is false. */ List * -RenameViewStmtObjectAddress(Node *node, bool missing_ok) +RenameViewStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -645,7 +645,7 @@ PreprocessAlterViewSchemaStmt(Node *node, const char *queryString, { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); - List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true); + List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true, false); /* the code-path only supports a single object */ Assert(list_length(viewAddresses) == 1); @@ -687,7 +687,7 @@ PostprocessAlterViewSchemaStmt(Node *node, const char *queryString) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); - List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true); + List *viewAddresses = GetObjectAddressListFromParseTree((Node *) stmt, true, true); /* the code-path only supports a single object */ Assert(list_length(viewAddresses) == 1); @@ -709,7 +709,7 @@ PostprocessAlterViewSchemaStmt(Node *node, const char *queryString) * of the alter schema statement. */ List * -AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok) +AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); diff --git a/src/backend/distributed/deparser/objectaddress.c b/src/backend/distributed/deparser/objectaddress.c index c6638b4e6..d835a3b1a 100644 --- a/src/backend/distributed/deparser/objectaddress.c +++ b/src/backend/distributed/deparser/objectaddress.c @@ -24,7 +24,7 @@ * tree. */ List * -GetObjectAddressListFromParseTree(Node *parseTree, bool missing_ok) +GetObjectAddressListFromParseTree(Node *parseTree, bool missing_ok, bool isPostprocess) { const DistributeObjectOps *ops = GetDistributeObjectOps(parseTree); @@ -33,12 +33,12 @@ GetObjectAddressListFromParseTree(Node *parseTree, bool missing_ok) ereport(ERROR, (errmsg("unsupported statement to get object address for"))); } - return ops->address(parseTree, missing_ok); + return ops->address(parseTree, missing_ok, isPostprocess); } List * -RenameAttributeStmtObjectAddress(Node *node, bool missing_ok) +RenameAttributeStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_ATTRIBUTE); @@ -68,7 +68,7 @@ RenameAttributeStmtObjectAddress(Node *node, bool missing_ok) * to true. */ List * -CreateExtensionStmtObjectAddress(Node *node, bool missing_ok) +CreateExtensionStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess) { CreateExtensionStmt *stmt = castNode(CreateExtensionStmt, node); ObjectAddress *address = palloc0(sizeof(ObjectAddress)); diff --git a/src/backend/distributed/utils/citus_depended_object.c b/src/backend/distributed/utils/citus_depended_object.c index 07e004f1c..101db1856 100644 --- a/src/backend/distributed/utils/citus_depended_object.c +++ b/src/backend/distributed/utils/citus_depended_object.c @@ -316,35 +316,43 @@ GetCitusDependedObjectArgs(int pgMetaTableVarno, int pgMetaTableOid) /* * DistOpsHasInvalidObject returns true if any address in the given node * is invalid; otherwise, returns false. If ops is null or it has no - * implemented address method, 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. + * implemented address method, we return false. We also have some dist ops + * for which we should not validate and return false. */ bool DistOpsHasInvalidObject(Node *node, const DistributeObjectOps *ops) { if (ops && ops->operationType == DIST_OPS_CREATE) { + /* + * We should not validate CREATE statements because no address exists + * here yet. + */ return false; } else if (StatementContainsIfExist(node)) { + /* + * We should not validate '[DROP|ALTER] IF EXISTS' statements because it is ok + * by the semantics even if any object is invalid. + */ return false; } else if (AlterRoleSetStatementContainsAll(node)) { + /* + * We should not validate 'ALTER ROLE ALL [SET|UNSET] because for the role ALL + * AlterRoleSetStmtObjectAddress returns an invalid address even though it should not. + */ return false; } if (ops && ops->address) { - List *objectAddresses = ops->address(node, true); + bool missingOk = true; + bool isPostprocess = false; + List *objectAddresses = ops->address(node, missingOk, isPostprocess); + ObjectAddress *objectAddress = NULL; foreach_ptr(objectAddress, objectAddresses) { diff --git a/src/backend/distributed/worker/worker_create_or_replace.c b/src/backend/distributed/worker/worker_create_or_replace.c index c6b749621..572cf1420 100644 --- a/src/backend/distributed/worker/worker_create_or_replace.c +++ b/src/backend/distributed/worker/worker_create_or_replace.c @@ -181,7 +181,7 @@ WorkerCreateOrReplaceObject(List *sqlStatements) * same subject. */ Node *parseTree = ParseTreeNode(linitial(sqlStatements)); - List *addresses = GetObjectAddressListFromParseTree(parseTree, true); + List *addresses = GetObjectAddressListFromParseTree(parseTree, true, false); Assert(list_length(addresses) == 1); /* We have already asserted that we have exactly 1 address in the addresses. */ diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index ffd2782bb..e1d38ed3c 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -39,6 +39,7 @@ extern void SwitchToSequentialAndLocalExecutionIfPartitionNameTooLong(Oid Oid partitionRelationId); +/* DistOpsOperationType to be used in DistributeObjectOps */ typedef enum DistOpsOperationType { DIST_OPS_NONE, @@ -60,7 +61,8 @@ typedef enum DistOpsOperationType * preprocess: executed before standard_ProcessUtility. * postprocess: executed after standard_ProcessUtility. * address: return an ObjectAddress for the subject of the statement. - * 2nd parameter is missing_ok. + * 2nd parameter is missing_ok, and + * 3rd parameter is isPostProcess. * markDistribued: true if the object will be distributed. * * preprocess/postprocess return a List of DDLJobs. @@ -71,7 +73,7 @@ typedef struct DistributeObjectOps void (*qualify)(Node *); List * (*preprocess)(Node *, const char *, ProcessUtilityContext); List * (*postprocess)(Node *, const char *); - List * (*address)(Node *, bool); + List * (*address)(Node *, bool, bool); bool markDistributed; /* fields used by common implementations, omitted for specialized implementations */ @@ -158,8 +160,10 @@ extern List * PostprocessAlterDistributedObjectStmt(Node *stmt, const char *quer extern List * PreprocessDropDistributedObjectStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * DropTextSearchConfigObjectAddress(Node *node, bool missing_ok); -extern List * DropTextSearchDictObjectAddress(Node *node, bool missing_ok); +extern List * DropTextSearchConfigObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * DropTextSearchDictObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); /* index.c */ typedef void (*PGIndexProcessor)(Form_pg_index, List **, int); @@ -172,24 +176,33 @@ extern bool CallDistributedProcedureRemotely(CallStmt *callStmt, DestReceiver *d /* collation.c - forward declarations */ extern char * CreateCollationDDL(Oid collationId); extern List * CreateCollationDDLsIdempotent(Oid collationId); -extern List * AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok); -extern List * RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); +extern List * RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); extern List * AlterCollationSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern char * GenerateBackupNameForCollationCollision(const ObjectAddress *address); -extern List * DefineCollationStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * DefineCollationStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); /* database.c - forward declarations */ -extern List * AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok); +extern List * AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern List * DatabaseOwnerDDLCommands(const ObjectAddress *address); /* domain.c - forward declarations */ -extern List * CreateDomainStmtObjectAddress(Node *node, bool missing_ok); -extern List * AlterDomainStmtObjectAddress(Node *node, bool missing_ok); +extern List * CreateDomainStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * AlterDomainStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern List * DomainRenameConstraintStmtObjectAddress(Node *node, - bool missing_ok); -extern List * AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok); -extern List * RenameDomainStmtObjectAddress(Node *node, bool missing_ok); + bool missing_ok, bool + isPostprocess); +extern List * AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * RenameDomainStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern CreateDomainStmt * RecreateDomainStmt(Oid domainOid); extern Oid get_constraint_typid(Oid conoid); @@ -222,9 +235,9 @@ extern List * PreprocessAlterExtensionContentsStmt(Node *node, processUtilityContext); extern List * CreateExtensionDDLCommand(const ObjectAddress *extensionAddress); extern List * AlterExtensionSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * AlterExtensionUpdateStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern void CreateExtensionWithVersion(char *extname, char *extVersion); extern void AlterExtensionUpdateStmt(char *extname, char *extVersion); extern int GetExtensionVersionNumber(char *extVersion); @@ -276,11 +289,14 @@ extern Acl * GetPrivilegesForFDW(Oid FDWOid); extern List * PreprocessGrantOnForeignServerStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok); -extern List * AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok); -extern List * RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok); +extern List * CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern List * AlterForeignServerOwnerStmtObjectAddress(Node *node, bool - missing_ok); + missing_ok, bool isPostprocess); extern List * GetForeignServerCreateDDLCommand(Oid serverId); @@ -296,25 +312,25 @@ extern List * PreprocessCreateFunctionStmt(Node *stmt, const char *queryString, extern List * PostprocessCreateFunctionStmt(Node *stmt, const char *queryString); extern List * CreateFunctionStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * DefineAggregateStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * PreprocessAlterFunctionStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * AlterFunctionStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * RenameFunctionStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * AlterFunctionOwnerObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * AlterFunctionSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * PreprocessAlterFunctionDependsStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * AlterFunctionDependsStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * PreprocessGrantOnFunctionStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessGrantOnFunctionStmt(Node *node, const char *queryString); @@ -341,7 +357,7 @@ extern LOCKMODE GetCreateIndexRelationLockMode(IndexStmt *createIndexStatement); extern List * PreprocessReindexStmt(Node *ReindexStatement, const char *ReindexCommand, ProcessUtilityContext processUtilityContext); -extern List * ReindexStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * ReindexStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess); extern List * PreprocessDropIndexStmt(Node *dropIndexStatement, const char *dropIndexCommand, ProcessUtilityContext processUtilityContext); @@ -354,7 +370,8 @@ extern List * ExecuteFunctionOnEachTableIndex(Oid relationId, PGIndexProcessor extern bool IsReindexWithParam_compat(ReindexStmt *stmt, char *paramName); /* objectaddress.c - forward declarations */ -extern List * CreateExtensionStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * CreateExtensionStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); /* policy.c - forward declarations */ @@ -391,9 +408,9 @@ extern List * PreprocessAlterRoleSetStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * GenerateAlterRoleSetCommandForRole(Oid roleid); extern List * AlterRoleStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * AlterRoleSetStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * PreprocessCreateRoleStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PreprocessDropRoleStmt(Node *stmt, const char *queryString, @@ -402,7 +419,8 @@ extern List * PreprocessGrantRoleStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessGrantRoleStmt(Node *stmt, const char *queryString); extern List * GenerateCreateOrAlterRoleCommand(Oid roleOid); -extern List * CreateRoleStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * CreateRoleStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); extern void UnmarkRolesDistributed(List *roles); extern List * FilterDistributedRoles(List *roles); @@ -416,8 +434,10 @@ extern List * PreprocessAlterObjectSchemaStmt(Node *alterObjectSchemaStmt, const char *alterObjectSchemaCommand); extern List * PreprocessGrantOnSchemaStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * CreateSchemaStmtObjectAddress(Node *node, bool missing_ok); -extern List * AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok); +extern List * CreateSchemaStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); /* sequence.c - forward declarations */ extern List * PreprocessAlterSequenceStmt(Node *node, const char *queryString, @@ -431,16 +451,21 @@ extern List * PreprocessAlterSequenceOwnerStmt(Node *node, const char *queryStri extern List * PostprocessAlterSequenceOwnerStmt(Node *node, const char *queryString); extern List * PreprocessDropSequenceStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * SequenceDropStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * SequenceDropStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); extern List * PreprocessRenameSequenceStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PreprocessGrantOnSequenceStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessGrantOnSequenceStmt(Node *node, const char *queryString); -extern List * AlterSequenceStmtObjectAddress(Node *node, bool missing_ok); -extern List * AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok); -extern List * AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok); -extern List * RenameSequenceStmtObjectAddress(Node *node, bool missing_ok); +extern List * AlterSequenceStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); +extern List * RenameSequenceStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern void ErrorIfUnsupportedSeqStmt(CreateSeqStmt *createSeqStmt); extern void ErrorIfDistributedAlterSeqOwnedBy(AlterSeqStmt *alterSeqStmt); extern char * GenerateBackupNameForSequenceCollision(const ObjectAddress *address); @@ -451,10 +476,12 @@ extern void RenameExistingSequenceWithDifferentTypeIfExists(RangeVar *sequence, extern List * PreprocessCreateStatisticsStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessCreateStatisticsStmt(Node *node, const char *queryString); -extern List * CreateStatisticsStmtObjectAddress(Node *node, bool missingOk); +extern List * CreateStatisticsStmtObjectAddress(Node *node, bool missingOk, bool + isPostprocess); extern List * PreprocessDropStatisticsStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * DropStatisticsObjectAddress(Node *node, bool missing_ok); +extern List * DropStatisticsObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern List * PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); @@ -462,7 +489,8 @@ extern List * PreprocessAlterStatisticsSchemaStmt(Node *node, const char *queryS ProcessUtilityContext processUtilityContext); extern List * PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString); -extern List * AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk); +extern List * AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk, bool + isPostprocess); extern List * PreprocessAlterStatisticsStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString, @@ -504,7 +532,7 @@ extern void ErrorIfUnsupportedConstraint(Relation relation, char distributionMet char referencingReplicationModel, Var *distributionColumn, uint32 colocationId); extern List * AlterTableSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * MakeNameListFromRangeVar(const RangeVar *rel); extern Oid GetSequenceOid(Oid relationId, AttrNumber attnum); extern bool ConstrTypeUsesIndex(ConstrType constrType); @@ -516,29 +544,38 @@ extern List * GetCreateTextSearchDictionaryStatements(const ObjectAddress *addre extern List * CreateTextSearchConfigDDLCommandsIdempotent(const ObjectAddress *address); extern List * CreateTextSearchDictDDLCommandsIdempotent(const ObjectAddress *address); extern List * CreateTextSearchConfigurationObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * CreateTextSearchDictObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * RenameTextSearchConfigurationStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * RenameTextSearchDictionaryStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * AlterTextSearchConfigurationStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * AlterTextSearchDictionaryStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * TextSearchConfigurationCommentObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * TextSearchDictCommentObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * AlterTextSearchConfigurationOwnerObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool + isPostprocess); extern List * AlterTextSearchDictOwnerObjectAddress(Node *node, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern char * GenerateBackupNameForTextSearchConfiguration(const ObjectAddress *address); extern char * GenerateBackupNameForTextSearchDict(const ObjectAddress *address); extern List * get_ts_config_namelist(Oid tsconfigOid); @@ -551,16 +588,20 @@ extern List * PreprocessRenameTypeAttributeStmt(Node *stmt, const char *queryStr ProcessUtilityContext processUtilityContext); extern Node * CreateTypeStmtByObjectAddress(const ObjectAddress *address); -extern List * CompositeTypeStmtObjectAddress(Node *stmt, bool missing_ok); -extern List * CreateEnumStmtObjectAddress(Node *stmt, bool missing_ok); -extern List * AlterTypeStmtObjectAddress(Node *stmt, bool missing_ok); -extern List * AlterEnumStmtObjectAddress(Node *stmt, bool missing_ok); -extern List * RenameTypeStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * CompositeTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); +extern List * CreateEnumStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); +extern List * AlterTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess); +extern List * AlterEnumStmtObjectAddress(Node *stmt, bool missing_ok, bool isPostprocess); +extern List * RenameTypeStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); extern List * AlterTypeSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); + bool missing_ok, bool isPostprocess); extern List * RenameTypeAttributeStmtObjectAddress(Node *stmt, bool missing_ok); -extern List * AlterTypeOwnerObjectAddress(Node *stmt, bool missing_ok); +extern List * AlterTypeOwnerObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); extern List * CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress); extern char * GenerateBackupNameForTypeCollision(const ObjectAddress *address); @@ -581,11 +622,11 @@ extern List * PostprocessVacuumStmt(Node *node, const char *vacuumCommand); extern List * PreprocessViewStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessViewStmt(Node *node, const char *queryString); -extern List * ViewStmtObjectAddress(Node *node, bool missing_ok); -extern List * AlterViewStmtObjectAddress(Node *node, bool missing_ok); +extern List * ViewStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); +extern List * AlterViewStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); extern List * PreprocessDropViewStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * DropViewStmtObjectAddress(Node *node, bool missing_ok); +extern List * DropViewStmtObjectAddress(Node *node, bool missing_ok, bool isPostprocess); extern char * CreateViewDDLCommand(Oid viewOid); extern List * GetViewCreationCommandsOfTable(Oid relationId); extern List * GetViewCreationTableDDLCommandsOfTable(Oid relationId); @@ -599,11 +640,13 @@ extern List * PreprocessAlterViewStmt(Node *node, const char *queryString, extern List * PostprocessAlterViewStmt(Node *node, const char *queryString); extern List * PreprocessRenameViewStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern List * RenameViewStmtObjectAddress(Node *node, bool missing_ok); +extern List * RenameViewStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern List * PreprocessAlterViewSchemaStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessAlterViewSchemaStmt(Node *node, const char *queryString); -extern List * AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok); +extern List * AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok, bool + isPostprocess); extern bool IsViewRenameStmt(RenameStmt *renameStmt); /* trigger.c - forward declarations */ @@ -611,7 +654,8 @@ extern List * GetExplicitTriggerCommandList(Oid relationId); extern HeapTuple GetTriggerTupleById(Oid triggerId, bool missingOk); extern List * GetExplicitTriggerIdList(Oid relationId); extern List * PostprocessCreateTriggerStmt(Node *node, const char *queryString); -extern List * CreateTriggerStmtObjectAddress(Node *node, bool missingOk); +extern List * CreateTriggerStmtObjectAddress(Node *node, bool missingOk, bool + isPostprocess); extern void CreateTriggerEventExtendNames(CreateTrigStmt *createTriggerStmt, char *schemaName, uint64 shardId); extern List * PostprocessAlterTriggerRenameStmt(Node *node, const char *queryString); diff --git a/src/include/distributed/deparser.h b/src/include/distributed/deparser.h index 23bfbae78..9ac15b6ac 100644 --- a/src/include/distributed/deparser.h +++ b/src/include/distributed/deparser.h @@ -148,8 +148,10 @@ extern void QualifyAlterTypeOwnerStmt(Node *stmt); extern char * GetTypeNamespaceNameByNameList(List *names); extern Oid TypeOidGetNamespaceOid(Oid typeOid); -extern List * GetObjectAddressListFromParseTree(Node *parseTree, bool missing_ok); -extern List * RenameAttributeStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * GetObjectAddressListFromParseTree(Node *parseTree, bool missing_ok, bool + isPostprocess); +extern List * RenameAttributeStmtObjectAddress(Node *stmt, bool missing_ok, bool + isPostprocess); /* forward declarations for deparse_view_stmts.c */ extern void QualifyDropViewStmt(Node *node);