diff --git a/src/backend/distributed/commands/collation.c b/src/backend/distributed/commands/collation.c index f9b977447..492e2ace2 100644 --- a/src/backend/distributed/commands/collation.c +++ b/src/backend/distributed/commands/collation.c @@ -169,7 +169,7 @@ CreateCollationDDLsIdempotent(Oid collationId) } -ObjectAddress +List * AlterCollationOwnerObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); @@ -177,8 +177,13 @@ AlterCollationOwnerObjectAddress(Node *node, bool missing_ok) Assert(stmt->objectType == OBJECT_COLLATION); - return get_object_address(stmt->objectType, stmt->object, &relation, - AccessExclusiveLock, missing_ok); + ObjectAddress objectAddress = get_object_address(stmt->objectType, stmt->object, + &relation, AccessExclusiveLock, + missing_ok); + + ObjectAddress *objectAddressCopy = palloc0(sizeof(ObjectAddress)); + *objectAddressCopy = objectAddress; + return list_make1(objectAddressCopy); } @@ -186,17 +191,17 @@ AlterCollationOwnerObjectAddress(Node *node, bool missing_ok) * RenameCollationStmtObjectAddress returns the ObjectAddress of the type that is the object * of the RenameStmt. Errors if missing_ok is false. */ -ObjectAddress +List * RenameCollationStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); Assert(stmt->renameType == OBJECT_COLLATION); Oid collationOid = get_collation_oid((List *) stmt->object, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, CollationRelationId, collationOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, CollationRelationId, collationOid); - return address; + return list_make1(address); } @@ -209,7 +214,7 @@ RenameCollationStmtObjectAddress(Node *node, bool missing_ok) * new schema. Errors if missing_ok is false and the type cannot be found in either of the * schemas. */ -ObjectAddress +List * AlterCollationSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -232,9 +237,9 @@ AlterCollationSchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress address = { 0 }; - ObjectAddressSet(address, CollationRelationId, collationOid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, CollationRelationId, collationOid); + return list_make1(address); } @@ -291,15 +296,15 @@ GenerateBackupNameForCollationCollision(const ObjectAddress *address) } -ObjectAddress +List * DefineCollationStmtObjectAddress(Node *node, bool missing_ok) { DefineStmt *stmt = castNode(DefineStmt, node); Assert(stmt->kind == OBJECT_COLLATION); Oid collOid = get_collation_oid(stmt->defnames, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, CollationRelationId, collOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, CollationRelationId, collOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index 6f451893e..2bd03d5d8 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -40,17 +40,17 @@ bool EnableAlterDatabaseOwner = true; * AlterDatabaseOwnerObjectAddress returns the ObjectAddress of the database that is the * object of the AlterOwnerStmt. Errors if missing_ok is false. */ -ObjectAddress +List * AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Assert(stmt->objectType == OBJECT_DATABASE); Oid databaseOid = get_database_oid(strVal((String *) stmt->object), missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, DatabaseRelationId, databaseOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, DatabaseRelationId, databaseOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/domain.c b/src/backend/distributed/commands/domain.c index c75af0024..50d195d58 100644 --- a/src/backend/distributed/commands/domain.c +++ b/src/backend/distributed/commands/domain.c @@ -37,7 +37,7 @@ static CollateClause * MakeCollateClauseFromOid(Oid collationOid); -static ObjectAddress GetDomainAddressByName(TypeName *domainName, bool missing_ok); +static List * GetDomainAddressByName(TypeName *domainName, bool missing_ok); /* * GetDomainAddressByName returns the ObjectAddress of the domain identified by @@ -45,13 +45,13 @@ static ObjectAddress GetDomainAddressByName(TypeName *domainName, bool missing_o * InvalidOid. When missing_ok is false this function will raise an error instead when the * domain can't be found. */ -static ObjectAddress +static List * GetDomainAddressByName(TypeName *domainName, bool missing_ok) { - ObjectAddress address = { 0 }; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); Oid domainOid = LookupTypeNameOid(NULL, domainName, missing_ok); - ObjectAddressSet(address, TypeRelationId, domainOid); - return address; + ObjectAddressSet(*address, TypeRelationId, domainOid); + return list_make1(address); } @@ -229,17 +229,17 @@ MakeCollateClauseFromOid(Oid collationOid) * created by the statement. When missing_ok is false the function will raise an error if * the domain cannot be found in the local catalog. */ -ObjectAddress +List * CreateDomainStmtObjectAddress(Node *node, bool missing_ok) { CreateDomainStmt *stmt = castNode(CreateDomainStmt, node); TypeName *typeName = makeTypeNameFromNameList(stmt->domainname); Oid typeOid = LookupTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -248,7 +248,7 @@ CreateDomainStmtObjectAddress(Node *node, bool missing_ok) * When missing_ok is false this function will raise an error when the domain is not * found. */ -ObjectAddress +List * AlterDomainStmtObjectAddress(Node *node, bool missing_ok) { AlterDomainStmt *stmt = castNode(AlterDomainStmt, node); @@ -263,7 +263,7 @@ AlterDomainStmtObjectAddress(Node *node, bool missing_ok) * which the constraint is being renamed. When missing_ok this function will raise an * error if the domain cannot be found. */ -ObjectAddress +List * DomainRenameConstraintStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -278,7 +278,7 @@ DomainRenameConstraintStmtObjectAddress(Node *node, bool missing_ok) * being changed. When missing_ok is false this function will raise an error if the domain * cannot be found. */ -ObjectAddress +List * AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); @@ -294,7 +294,7 @@ AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok) * When missing_ok is false this function will raise an error when the domain cannot be * found. */ -ObjectAddress +List * RenameDomainStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); diff --git a/src/backend/distributed/commands/extension.c b/src/backend/distributed/commands/extension.c index 6f45cec5b..e4979f035 100644 --- a/src/backend/distributed/commands/extension.c +++ b/src/backend/distributed/commands/extension.c @@ -1128,7 +1128,7 @@ GetDependentFDWsToExtension(Oid extensionId) * AlterExtensionSchemaStmtObjectAddress returns the ObjectAddress of the extension that is * the subject of the AlterObjectSchemaStmt. Errors if missing_ok is false. */ -ObjectAddress +List * AlterExtensionSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -1145,10 +1145,10 @@ AlterExtensionSchemaStmtObjectAddress(Node *node, bool missing_ok) extensionName))); } - ObjectAddress address = { 0 }; - ObjectAddressSet(address, ExtensionRelationId, extensionOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, ExtensionRelationId, extensionOid); - return address; + return list_make1(address); } @@ -1156,7 +1156,7 @@ AlterExtensionSchemaStmtObjectAddress(Node *node, bool missing_ok) * AlterExtensionUpdateStmtObjectAddress returns the ObjectAddress of the extension that is * the subject of the AlterExtensionStmt. Errors if missing_ok is false. */ -ObjectAddress +List * AlterExtensionUpdateStmtObjectAddress(Node *node, bool missing_ok) { AlterExtensionStmt *stmt = castNode(AlterExtensionStmt, node); @@ -1171,10 +1171,10 @@ AlterExtensionUpdateStmtObjectAddress(Node *node, bool missing_ok) extensionName))); } - ObjectAddress address = { 0 }; - ObjectAddressSet(address, ExtensionRelationId, extensionOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, ExtensionRelationId, extensionOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/foreign_server.c b/src/backend/distributed/commands/foreign_server.c index 0502b2ef4..36b6094a9 100644 --- a/src/backend/distributed/commands/foreign_server.c +++ b/src/backend/distributed/commands/foreign_server.c @@ -16,6 +16,7 @@ #include "distributed/commands.h" #include "distributed/deparser.h" #include "distributed/listutils.h" +#include "distributed/log_utils.h" #include "distributed/metadata/distobject.h" #include "distributed/metadata_sync.h" #include "distributed/multi_executor.h" @@ -29,7 +30,7 @@ static char * GetForeignServerAlterOwnerCommand(Oid serverId); static Node * RecreateForeignServerStmt(Oid serverId); static bool NameListHasDistributedServer(List *serverNames); -static ObjectAddress GetObjectAddressByServerName(char *serverName, bool missing_ok); +static List * GetObjectAddressByServerName(char *serverName, bool missing_ok); /* @@ -40,7 +41,7 @@ static ObjectAddress GetObjectAddressByServerName(char *serverName, bool missing * Never returns NULL, but the objid in the address can be invalid if missingOk * was set to true. */ -ObjectAddress +List * CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok) { CreateForeignServerStmt *stmt = castNode(CreateForeignServerStmt, node); @@ -57,7 +58,7 @@ CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok) * Never returns NULL, but the objid in the address can be invalid if missingOk * was set to true. */ -ObjectAddress +List * AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok) { AlterForeignServerStmt *stmt = castNode(AlterForeignServerStmt, node); @@ -121,7 +122,7 @@ PreprocessGrantOnForeignServerStmt(Node *node, const char *queryString, * Never returns NULL, but the objid in the address can be invalid if missingOk * was set to true. */ -ObjectAddress +List * RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -139,7 +140,7 @@ RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok) * Never returns NULL, but the objid in the address can be invalid if missingOk * was set to true. */ -ObjectAddress +List * AlterForeignServerOwnerStmtObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); @@ -245,9 +246,16 @@ NameListHasDistributedServer(List *serverNames) String *serverValue = NULL; foreach_ptr(serverValue, serverNames) { - ObjectAddress address = GetObjectAddressByServerName(strVal(serverValue), false); + List *addresses = GetObjectAddressByServerName(strVal(serverValue), false); + if (list_length(addresses) > 1) + { + ereport(ERROR, errmsg( + "citus does not support multiple object addresses in NameListHasDistributedServer")); + } - if (IsObjectDistributed(&address)) + ObjectAddress *address = linitial(addresses); + + if (IsObjectDistributed(address)) { return true; } @@ -257,13 +265,13 @@ NameListHasDistributedServer(List *serverNames) } -static ObjectAddress +static List * GetObjectAddressByServerName(char *serverName, bool missing_ok) { ForeignServer *server = GetForeignServerByName(serverName, missing_ok); Oid serverOid = server->serverid; - ObjectAddress address = { 0 }; - ObjectAddressSet(address, ForeignServerRelationId, serverOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, ForeignServerRelationId, serverOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/function.c b/src/backend/distributed/commands/function.c index 73c014c6a..ccf2ef2f3 100644 --- a/src/backend/distributed/commands/function.c +++ b/src/backend/distributed/commands/function.c @@ -88,9 +88,9 @@ static void EnsureFunctionCanBeColocatedWithTable(Oid functionOid, Oid static bool ShouldPropagateCreateFunction(CreateFunctionStmt *stmt); static bool ShouldPropagateAlterFunction(const ObjectAddress *address); static bool ShouldAddFunctionSignature(FunctionParameterMode mode); -static ObjectAddress FunctionToObjectAddress(ObjectType objectType, - ObjectWithArgs *objectWithArgs, - bool missing_ok); +static List * FunctionToObjectAddress(ObjectType objectType, + ObjectWithArgs *objectWithArgs, + bool missing_ok); static void ErrorIfUnsupportedAlterFunctionStmt(AlterFunctionStmt *stmt); static char * quote_qualified_func_name(Oid funcOid); static void DistributeFunctionWithDistributionArgument(RegProcedure funcOid, @@ -1405,7 +1405,7 @@ PostprocessCreateFunctionStmt(Node *node, const char *queryString) * CREATE [OR REPLACE] FUNCTION statement. If missing_ok is false it will error with the * normal postgres error for unfound functions. */ -ObjectAddress +List * CreateFunctionStmtObjectAddress(Node *node, bool missing_ok) { CreateFunctionStmt *stmt = castNode(CreateFunctionStmt, node); @@ -1440,7 +1440,7 @@ CreateFunctionStmtObjectAddress(Node *node, bool missing_ok) * * objectId in the address can be invalid if missing_ok was set to true. */ -ObjectAddress +List * DefineAggregateStmtObjectAddress(Node *node, bool missing_ok) { DefineStmt *stmt = castNode(DefineStmt, node); @@ -1576,7 +1576,7 @@ PreprocessAlterFunctionDependsStmt(Node *node, const char *queryString, * is the subject of an ALTER FUNCTION ... DEPENS ON EXTENSION ... statement. If * missing_ok is set to false the lookup will raise an error. */ -ObjectAddress +List * AlterFunctionDependsStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectDependsStmt *stmt = castNode(AlterObjectDependsStmt, node); @@ -1592,7 +1592,7 @@ AlterFunctionDependsStmtObjectAddress(Node *node, bool missing_ok) * AlterFunctionStmt. If missing_ok is set to false an error will be raised if postgres * was unable to find the function/procedure that was the target of the statement. */ -ObjectAddress +List * AlterFunctionStmtObjectAddress(Node *node, bool missing_ok) { AlterFunctionStmt *stmt = castNode(AlterFunctionStmt, node); @@ -1604,7 +1604,7 @@ AlterFunctionStmtObjectAddress(Node *node, bool missing_ok) * RenameFunctionStmtObjectAddress returns the ObjectAddress of the function that is the * subject of the RenameStmt. Errors if missing_ok is false. */ -ObjectAddress +List * RenameFunctionStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -1617,7 +1617,7 @@ RenameFunctionStmtObjectAddress(Node *node, bool missing_ok) * AlterFunctionOwnerObjectAddress returns the ObjectAddress of the function that is the * subject of the AlterOwnerStmt. Errors if missing_ok is false. */ -ObjectAddress +List * AlterFunctionOwnerObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); @@ -1635,7 +1635,7 @@ AlterFunctionOwnerObjectAddress(Node *node, bool missing_ok) * the new schema. Errors if missing_ok is false and the type cannot be found in either of * the schemas. */ -ObjectAddress +List * AlterFunctionSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -1680,10 +1680,10 @@ AlterFunctionSchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress address = { 0 }; - ObjectAddressSet(address, ProcedureRelationId, funcOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, ProcedureRelationId, funcOid); - return address; + return list_make1(address); } @@ -1827,17 +1827,17 @@ ShouldAddFunctionSignature(FunctionParameterMode mode) * Function/Procedure/Aggregate. If missing_ok is set to false an error will be * raised by postgres explaining the Function/Procedure could not be found. */ -static ObjectAddress +static List * FunctionToObjectAddress(ObjectType objectType, ObjectWithArgs *objectWithArgs, bool missing_ok) { AssertObjectTypeIsFunctional(objectType); Oid funcOid = LookupFuncWithArgs(objectType, objectWithArgs, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, ProcedureRelationId, funcOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, ProcedureRelationId, funcOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/role.c b/src/backend/distributed/commands/role.c index 4c4a7053a..6d19d6726 100644 --- a/src/backend/distributed/commands/role.c +++ b/src/backend/distributed/commands/role.c @@ -74,7 +74,7 @@ static Node * makeFloatConst(char *str, int location); static const char * WrapQueryInAlterRoleIfExistsCall(const char *query, RoleSpec *role); static VariableSetStmt * MakeVariableSetStmt(const char *config); static int ConfigGenericNameCompare(const void *lhs, const void *rhs); -static ObjectAddress RoleSpecToObjectAddress(RoleSpec *role, bool missing_ok); +static List * RoleSpecToObjectAddress(RoleSpec *role, bool missing_ok); /* controlled via GUC */ bool EnableCreateRolePropagation = true; @@ -87,7 +87,7 @@ bool EnableAlterRoleSetPropagation = true; * AlterRoleStmt. If missing_ok is set to false an error will be raised if postgres * was unable to find the role that was the target of the statement. */ -ObjectAddress +List * AlterRoleStmtObjectAddress(Node *node, bool missing_ok) { AlterRoleStmt *stmt = castNode(AlterRoleStmt, node); @@ -100,7 +100,7 @@ AlterRoleStmtObjectAddress(Node *node, bool missing_ok) * AlterRoleSetStmt. If missing_ok is set to false an error will be raised if postgres * was unable to find the role that was the target of the statement. */ -ObjectAddress +List * AlterRoleSetStmtObjectAddress(Node *node, bool missing_ok) { AlterRoleSetStmt *stmt = castNode(AlterRoleSetStmt, node); @@ -113,19 +113,19 @@ AlterRoleSetStmtObjectAddress(Node *node, bool missing_ok) * RoleSpec. If missing_ok is set to false an error will be raised by postgres * explaining the Role could not be found. */ -static ObjectAddress +static List * RoleSpecToObjectAddress(RoleSpec *role, bool missing_ok) { - ObjectAddress address = { 0 }; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); if (role != NULL) { /* roles can be NULL for statements on ALL roles eg. ALTER ROLE ALL SET ... */ Oid roleOid = get_rolespec_oid(role, missing_ok); - ObjectAddressSet(address, AuthIdRelationId, roleOid); + ObjectAddressSet(*address, AuthIdRelationId, roleOid); } - return address; + return list_make1(address); } @@ -1179,15 +1179,15 @@ ConfigGenericNameCompare(const void *a, const void *b) * Never returns NULL, but the objid in the address could be invalid if missing_ok was set * to true. */ -ObjectAddress +List * CreateRoleStmtObjectAddress(Node *node, bool missing_ok) { CreateRoleStmt *stmt = castNode(CreateRoleStmt, node); Oid roleOid = get_role_oid(stmt->role, missing_ok); - ObjectAddress roleAddress = { 0 }; - ObjectAddressSet(roleAddress, AuthIdRelationId, roleOid); + ObjectAddress *roleAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*roleAddress, AuthIdRelationId, roleOid); - return roleAddress; + return list_make1(roleAddress); } diff --git a/src/backend/distributed/commands/schema.c b/src/backend/distributed/commands/schema.c index 47af36efd..825a56b09 100644 --- a/src/backend/distributed/commands/schema.c +++ b/src/backend/distributed/commands/schema.c @@ -40,7 +40,7 @@ #include "utils/relcache.h" -static ObjectAddress GetObjectAddressBySchemaName(char *schemaName, bool missing_ok); +static List * GetObjectAddressBySchemaName(char *schemaName, bool missing_ok); static List * FilterDistributedSchemas(List *schemas); static bool SchemaHasDistributedTableWithFKey(char *schemaName); static bool ShouldPropagateCreateSchemaStmt(void); @@ -183,7 +183,7 @@ PreprocessGrantOnSchemaStmt(Node *node, const char *queryString, * CreateSchemaStmtObjectAddress returns the ObjectAddress of the schema that is * the object of the CreateSchemaStmt. Errors if missing_ok is false. */ -ObjectAddress +List * CreateSchemaStmtObjectAddress(Node *node, bool missing_ok) { CreateSchemaStmt *stmt = castNode(CreateSchemaStmt, node); @@ -213,7 +213,7 @@ CreateSchemaStmtObjectAddress(Node *node, bool missing_ok) * AlterSchemaRenameStmtObjectAddress returns the ObjectAddress of the schema that is * the object of the RenameStmt. Errors if missing_ok is false. */ -ObjectAddress +List * AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -227,15 +227,15 @@ AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok) * GetObjectAddressBySchemaName returns the ObjectAddress of the schema with the * given name. Errors out if schema is not found and missing_ok is false. */ -ObjectAddress +List * GetObjectAddressBySchemaName(char *schemaName, bool missing_ok) { Oid schemaOid = get_namespace_oid(schemaName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, NamespaceRelationId, schemaOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, NamespaceRelationId, schemaOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/sequence.c b/src/backend/distributed/commands/sequence.c index 4e5cd18de..324e373b5 100644 --- a/src/backend/distributed/commands/sequence.c +++ b/src/backend/distributed/commands/sequence.c @@ -358,7 +358,7 @@ PreprocessRenameSequenceStmt(Node *node, const char *queryString, ProcessUtility * RenameSequenceStmtObjectAddress returns the ObjectAddress of the sequence that is the * subject of the RenameStmt. */ -ObjectAddress +List * RenameSequenceStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -366,10 +366,10 @@ RenameSequenceStmtObjectAddress(Node *node, bool missing_ok) RangeVar *sequence = stmt->relation; Oid seqOid = RangeVarGetRelid(sequence, NoLock, missing_ok); - ObjectAddress sequenceAddress = { 0 }; - ObjectAddressSet(sequenceAddress, RelationRelationId, seqOid); + ObjectAddress *sequenceAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*sequenceAddress, RelationRelationId, seqOid); - return sequenceAddress; + return list_make1(sequenceAddress); } @@ -471,17 +471,17 @@ SequenceUsedInDistributedTable(const ObjectAddress *sequenceAddress) * AlterSequenceStmtObjectAddress returns the ObjectAddress of the sequence that is the * subject of the AlterSeqStmt. */ -ObjectAddress +List * AlterSequenceStmtObjectAddress(Node *node, bool missing_ok) { AlterSeqStmt *stmt = castNode(AlterSeqStmt, node); RangeVar *sequence = stmt->sequence; Oid seqOid = RangeVarGetRelid(sequence, NoLock, stmt->missing_ok); - ObjectAddress sequenceAddress = { 0 }; - ObjectAddressSet(sequenceAddress, RelationRelationId, seqOid); + ObjectAddress *sequenceAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*sequenceAddress, RelationRelationId, seqOid); - return sequenceAddress; + return list_make1(sequenceAddress); } @@ -521,7 +521,7 @@ PreprocessAlterSequenceSchemaStmt(Node *node, const char *queryString, * AlterSequenceSchemaStmtObjectAddress returns the ObjectAddress of the sequence that is * the subject of the AlterObjectSchemaStmt. */ -ObjectAddress +List * AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -555,10 +555,10 @@ AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress sequenceAddress = { 0 }; - ObjectAddressSet(sequenceAddress, RelationRelationId, seqOid); + ObjectAddress *sequenceAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*sequenceAddress, RelationRelationId, seqOid); - return sequenceAddress; + return list_make1(sequenceAddress); } @@ -623,7 +623,7 @@ PreprocessAlterSequenceOwnerStmt(Node *node, const char *queryString, * AlterSequenceOwnerStmtObjectAddress returns the ObjectAddress of the sequence that is the * subject of the AlterOwnerStmt. */ -ObjectAddress +List * AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok) { AlterTableStmt *stmt = castNode(AlterTableStmt, node); @@ -631,10 +631,10 @@ AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok) RangeVar *sequence = stmt->relation; Oid seqOid = RangeVarGetRelid(sequence, NoLock, missing_ok); - ObjectAddress sequenceAddress = { 0 }; - ObjectAddressSet(sequenceAddress, RelationRelationId, seqOid); + ObjectAddress *sequenceAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*sequenceAddress, RelationRelationId, seqOid); - return sequenceAddress; + return list_make1(sequenceAddress); } diff --git a/src/backend/distributed/commands/statistics.c b/src/backend/distributed/commands/statistics.c index bf48505a5..48ed8df20 100644 --- a/src/backend/distributed/commands/statistics.c +++ b/src/backend/distributed/commands/statistics.c @@ -138,16 +138,16 @@ PostprocessCreateStatisticsStmt(Node *node, const char *queryString) * Never returns NULL, but the objid in the address can be invalid if missingOk * was set to true. */ -ObjectAddress +List * CreateStatisticsStmtObjectAddress(Node *node, bool missingOk) { CreateStatsStmt *stmt = castNode(CreateStatsStmt, node); - ObjectAddress address = { 0 }; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); Oid statsOid = get_statistics_object_oid(stmt->defnames, missingOk); - ObjectAddressSet(address, StatisticExtRelationId, statsOid); + ObjectAddressSet(*address, StatisticExtRelationId, statsOid); - return address; + return list_make1(address); } @@ -322,18 +322,18 @@ PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString) * Never returns NULL, but the objid in the address can be invalid if missingOk * was set to true. */ -ObjectAddress +List * AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); - ObjectAddress address = { 0 }; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); String *statName = llast((List *) stmt->object); Oid statsOid = get_statistics_object_oid(list_make2(makeString(stmt->newschema), statName), missingOk); - ObjectAddressSet(address, StatisticExtRelationId, statsOid); + ObjectAddressSet(*address, StatisticExtRelationId, statsOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index 8a73f1471..05f2a82ab 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -3353,7 +3353,7 @@ ErrorIfUnsupportedAlterAddConstraintStmt(AlterTableStmt *alterTableStatement) * will look in the new schema. Errors if missing_ok is false and the table cannot * be found in either of the schemas. */ -ObjectAddress +List * AlterTableSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -3389,10 +3389,10 @@ AlterTableSchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress address = { 0 }; - ObjectAddressSet(address, RelationRelationId, tableOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, RelationRelationId, tableOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/text_search.c b/src/backend/distributed/commands/text_search.c index 05319324d..22ff5df2f 100644 --- a/src/backend/distributed/commands/text_search.c +++ b/src/backend/distributed/commands/text_search.c @@ -569,7 +569,7 @@ get_ts_parser_namelist(Oid tsparserOid) * being created. If missing_pk is false the function will error, explaining to the user * the text search configuration described in the statement doesn't exist. */ -ObjectAddress +List * CreateTextSearchConfigurationObjectAddress(Node *node, bool missing_ok) { DefineStmt *stmt = castNode(DefineStmt, node); @@ -577,9 +577,9 @@ CreateTextSearchConfigurationObjectAddress(Node *node, bool missing_ok) Oid objid = get_ts_config_oid(stmt->defnames, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSConfigRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSConfigRelationId, objid); + return list_make1(address); } @@ -588,7 +588,7 @@ CreateTextSearchConfigurationObjectAddress(Node *node, bool missing_ok) * being created. If missing_pk is false the function will error, explaining to the user * the text search dictionary described in the statement doesn't exist. */ -ObjectAddress +List * CreateTextSearchDictObjectAddress(Node *node, bool missing_ok) { DefineStmt *stmt = castNode(DefineStmt, node); @@ -596,9 +596,9 @@ CreateTextSearchDictObjectAddress(Node *node, bool missing_ok) Oid objid = get_ts_dict_oid(stmt->defnames, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSDictionaryRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSDictionaryRelationId, objid); + return list_make1(address); } @@ -607,7 +607,7 @@ CreateTextSearchDictObjectAddress(Node *node, bool missing_ok) * SEARCH CONFIGURATION being renamed. Optionally errors if the configuration does not * exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * RenameTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -615,9 +615,9 @@ RenameTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) Oid objid = get_ts_config_oid(castNode(List, stmt->object), missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSConfigRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSConfigRelationId, objid); + return list_make1(address); } @@ -626,7 +626,7 @@ RenameTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) * SEARCH DICTIONARY being renamed. Optionally errors if the dictionary does not * exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * RenameTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -634,9 +634,9 @@ RenameTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) Oid objid = get_ts_dict_oid(castNode(List, stmt->object), missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSDictionaryRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSDictionaryRelationId, objid); + return list_make1(address); } @@ -645,16 +645,16 @@ RenameTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) * SEARCH CONFIGURATION being altered. Optionally errors if the configuration does not * exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * AlterTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) { AlterTSConfigurationStmt *stmt = castNode(AlterTSConfigurationStmt, node); Oid objid = get_ts_config_oid(stmt->cfgname, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSConfigRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSConfigRelationId, objid); + return list_make1(address); } @@ -663,16 +663,16 @@ AlterTextSearchConfigurationStmtObjectAddress(Node *node, bool missing_ok) * SEARCH CONFIGURATION being altered. Optionally errors if the configuration does not * exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * AlterTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) { AlterTSDictionaryStmt *stmt = castNode(AlterTSDictionaryStmt, node); Oid objid = get_ts_dict_oid(stmt->dictname, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSDictionaryRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSDictionaryRelationId, objid); + return list_make1(address); } @@ -685,7 +685,7 @@ AlterTextSearchDictionaryStmtObjectAddress(Node *node, bool missing_ok) * the triple checking before the error might be thrown. Errors for non-existing schema's * in edgecases will be raised by postgres while executing the move. */ -ObjectAddress +List * AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -723,9 +723,9 @@ AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress sequenceAddress = { 0 }; - ObjectAddressSet(sequenceAddress, TSConfigRelationId, objid); - return sequenceAddress; + ObjectAddress *sequenceAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*sequenceAddress, TSConfigRelationId, objid); + return list_make1(sequenceAddress); } @@ -738,7 +738,7 @@ AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, bool missing_ok) * the triple checking before the error might be thrown. Errors for non-existing schema's * in edgecases will be raised by postgres while executing the move. */ -ObjectAddress +List * AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -776,9 +776,9 @@ AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress sequenceAddress = { 0 }; - ObjectAddressSet(sequenceAddress, TSDictionaryRelationId, objid); - return sequenceAddress; + ObjectAddress *sequenceAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*sequenceAddress, TSDictionaryRelationId, objid); + return list_make1(sequenceAddress); } @@ -787,7 +787,7 @@ AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, bool missing_ok) * SEARCH CONFIGURATION on which the comment is placed. Optionally errors if the * configuration does not exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * TextSearchConfigurationCommentObjectAddress(Node *node, bool missing_ok) { CommentStmt *stmt = castNode(CommentStmt, node); @@ -795,9 +795,9 @@ TextSearchConfigurationCommentObjectAddress(Node *node, bool missing_ok) Oid objid = get_ts_config_oid(castNode(List, stmt->object), missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSConfigRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSConfigRelationId, objid); + return list_make1(address); } @@ -806,7 +806,7 @@ TextSearchConfigurationCommentObjectAddress(Node *node, bool missing_ok) * DICTIONARY on which the comment is placed. Optionally errors if the dictionary does not * exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * TextSearchDictCommentObjectAddress(Node *node, bool missing_ok) { CommentStmt *stmt = castNode(CommentStmt, node); @@ -814,9 +814,9 @@ TextSearchDictCommentObjectAddress(Node *node, bool missing_ok) Oid objid = get_ts_dict_oid(castNode(List, stmt->object), missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TSDictionaryRelationId, objid); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TSDictionaryRelationId, objid); + return list_make1(address); } @@ -825,7 +825,7 @@ TextSearchDictCommentObjectAddress(Node *node, bool missing_ok) * SEARCH CONFIGURATION for which the owner is changed. Optionally errors if the * configuration does not exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * AlterTextSearchConfigurationOwnerObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); @@ -833,8 +833,14 @@ AlterTextSearchConfigurationOwnerObjectAddress(Node *node, bool missing_ok) Assert(stmt->objectType == OBJECT_TSCONFIGURATION); - return get_object_address(stmt->objectType, stmt->object, &relation, AccessShareLock, - missing_ok); + ObjectAddress objectAddress = get_object_address(stmt->objectType, stmt->object, + &relation, AccessShareLock, + missing_ok); + + ObjectAddress *objectAddressCopy = palloc0(sizeof(ObjectAddress)); + *objectAddressCopy = objectAddress; + + return list_make1(objectAddressCopy); } @@ -843,16 +849,20 @@ AlterTextSearchConfigurationOwnerObjectAddress(Node *node, bool missing_ok) * SEARCH DICTIONARY for which the owner is changed. Optionally errors if the * configuration does not exist based on the missing_ok flag passed in by the caller. */ -ObjectAddress +List * AlterTextSearchDictOwnerObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); Relation relation = NULL; Assert(stmt->objectType == OBJECT_TSDICTIONARY); + ObjectAddress objectAddress = get_object_address(stmt->objectType, stmt->object, + &relation, AccessShareLock, + missing_ok); + ObjectAddress *objectAddressCopy = palloc0(sizeof(ObjectAddress)); + *objectAddressCopy = objectAddress; - return get_object_address(stmt->objectType, stmt->object, &relation, AccessShareLock, - missing_ok); + return list_make1(objectAddressCopy); } diff --git a/src/backend/distributed/commands/trigger.c b/src/backend/distributed/commands/trigger.c index 94f4f4cef..12d7253e2 100644 --- a/src/backend/distributed/commands/trigger.c +++ b/src/backend/distributed/commands/trigger.c @@ -241,7 +241,7 @@ PostprocessCreateTriggerStmt(Node *node, const char *queryString) * Never returns NULL, but the objid in the address can be invalid if missingOk * was set to true. */ -ObjectAddress +List * CreateTriggerStmtObjectAddress(Node *node, bool missingOk) { CreateTrigStmt *createTriggerStmt = castNode(CreateTrigStmt, node); @@ -260,9 +260,9 @@ CreateTriggerStmtObjectAddress(Node *node, bool missingOk) triggerName, relationName))); } - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TriggerRelationId, triggerId); - return address; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TriggerRelationId, triggerId); + return list_make1(address); } diff --git a/src/backend/distributed/commands/type.c b/src/backend/distributed/commands/type.c index 9931f430a..9ebe51510 100644 --- a/src/backend/distributed/commands/type.c +++ b/src/backend/distributed/commands/type.c @@ -300,16 +300,16 @@ EnumValsList(Oid typeOid) * Never returns NULL, but the objid in the address could be invalid if missing_ok was set * to true. */ -ObjectAddress +List * CompositeTypeStmtObjectAddress(Node *node, bool missing_ok) { CompositeTypeStmt *stmt = castNode(CompositeTypeStmt, node); TypeName *typeName = MakeTypeNameFromRangeVar(stmt->typevar); Oid typeOid = LookupNonAssociatedArrayTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -321,16 +321,16 @@ CompositeTypeStmtObjectAddress(Node *node, bool missing_ok) * Never returns NULL, but the objid in the address could be invalid if missing_ok was set * to true. */ -ObjectAddress +List * CreateEnumStmtObjectAddress(Node *node, bool missing_ok) { CreateEnumStmt *stmt = castNode(CreateEnumStmt, node); TypeName *typeName = makeTypeNameFromNameList(stmt->typeName); Oid typeOid = LookupNonAssociatedArrayTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -342,7 +342,7 @@ CreateEnumStmtObjectAddress(Node *node, bool missing_ok) * Never returns NULL, but the objid in the address could be invalid if missing_ok was set * to true. */ -ObjectAddress +List * AlterTypeStmtObjectAddress(Node *node, bool missing_ok) { AlterTableStmt *stmt = castNode(AlterTableStmt, node); @@ -350,10 +350,10 @@ AlterTypeStmtObjectAddress(Node *node, bool missing_ok) TypeName *typeName = MakeTypeNameFromRangeVar(stmt->relation); Oid typeOid = LookupTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -361,16 +361,16 @@ AlterTypeStmtObjectAddress(Node *node, bool missing_ok) * AlterEnumStmtObjectAddress return the ObjectAddress of the enum type that is the * object of the AlterEnumStmt. Errors is missing_ok is false. */ -ObjectAddress +List * AlterEnumStmtObjectAddress(Node *node, bool missing_ok) { AlterEnumStmt *stmt = castNode(AlterEnumStmt, node); TypeName *typeName = makeTypeNameFromNameList(stmt->typeName); Oid typeOid = LookupTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -378,7 +378,7 @@ AlterEnumStmtObjectAddress(Node *node, bool missing_ok) * RenameTypeStmtObjectAddress returns the ObjectAddress of the type that is the object * of the RenameStmt. Errors if missing_ok is false. */ -ObjectAddress +List * RenameTypeStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -386,10 +386,10 @@ RenameTypeStmtObjectAddress(Node *node, bool missing_ok) TypeName *typeName = makeTypeNameFromNameList((List *) stmt->object); Oid typeOid = LookupTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -402,7 +402,7 @@ RenameTypeStmtObjectAddress(Node *node, bool missing_ok) * new schema. Errors if missing_ok is false and the type cannot be found in either of the * schemas. */ -ObjectAddress +List * AlterTypeSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -447,10 +447,10 @@ AlterTypeSchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -462,7 +462,7 @@ AlterTypeSchemaStmtObjectAddress(Node *node, bool missing_ok) * changed as Attributes are not distributed on their own but as a side effect of the * whole type distribution. */ -ObjectAddress +List * RenameTypeAttributeStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -471,10 +471,10 @@ RenameTypeAttributeStmtObjectAddress(Node *node, bool missing_ok) TypeName *typeName = MakeTypeNameFromRangeVar(stmt->relation); Oid typeOid = LookupTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } @@ -482,7 +482,7 @@ RenameTypeAttributeStmtObjectAddress(Node *node, bool missing_ok) * AlterTypeOwnerObjectAddress returns the ObjectAddress of the type that is the object * of the AlterOwnerStmt. Errors if missing_ok is false. */ -ObjectAddress +List * AlterTypeOwnerObjectAddress(Node *node, bool missing_ok) { AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); @@ -490,10 +490,10 @@ AlterTypeOwnerObjectAddress(Node *node, bool missing_ok) TypeName *typeName = makeTypeNameFromNameList((List *) stmt->object); Oid typeOid = LookupTypeNameOid(NULL, typeName, missing_ok); - ObjectAddress address = { 0 }; - ObjectAddressSet(address, TypeRelationId, typeOid); + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*address, TypeRelationId, typeOid); - return address; + return list_make1(address); } diff --git a/src/backend/distributed/commands/view.c b/src/backend/distributed/commands/view.c index adae0c84e..daf255652 100644 --- a/src/backend/distributed/commands/view.c +++ b/src/backend/distributed/commands/view.c @@ -152,17 +152,17 @@ PostprocessViewStmt(Node *node, const char *queryString) * ViewStmtObjectAddress returns the ObjectAddress for the subject of the * CREATE [OR REPLACE] VIEW statement. */ -ObjectAddress +List * ViewStmtObjectAddress(Node *node, bool missing_ok) { ViewStmt *stmt = castNode(ViewStmt, node); Oid viewOid = RangeVarGetRelid(stmt->view, NoLock, missing_ok); - ObjectAddress viewAddress = { 0 }; - ObjectAddressSet(viewAddress, RelationRelationId, viewOid); + ObjectAddress *viewAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*viewAddress, RelationRelationId, viewOid); - return viewAddress; + return list_make1(viewAddress); } @@ -520,16 +520,16 @@ PostprocessAlterViewStmt(Node *node, const char *queryString) * AlterViewStmtObjectAddress returns the ObjectAddress for the subject of the * ALTER VIEW statement. */ -ObjectAddress +List * AlterViewStmtObjectAddress(Node *node, bool missing_ok) { AlterTableStmt *stmt = castNode(AlterTableStmt, node); Oid viewOid = RangeVarGetRelid(stmt->relation, NoLock, missing_ok); - ObjectAddress viewAddress = { 0 }; - ObjectAddressSet(viewAddress, RelationRelationId, viewOid); + ObjectAddress *viewAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*viewAddress, RelationRelationId, viewOid); - return viewAddress; + return list_make1(viewAddress); } @@ -572,17 +572,17 @@ PreprocessRenameViewStmt(Node *node, const char *queryString, * RenameViewStmtObjectAddress returns the ObjectAddress of the view that is the object * of the RenameStmt. Errors if missing_ok is false. */ -ObjectAddress +List * RenameViewStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); Oid viewOid = RangeVarGetRelid(stmt->relation, NoLock, missing_ok); - ObjectAddress viewAddress = { 0 }; - ObjectAddressSet(viewAddress, RelationRelationId, viewOid); + ObjectAddress *viewAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*viewAddress, RelationRelationId, viewOid); - return viewAddress; + return list_make1(viewAddress); } @@ -648,7 +648,7 @@ PostprocessAlterViewSchemaStmt(Node *node, const char *queryString) * AlterViewSchemaStmtObjectAddress returns the ObjectAddress of the view that is the object * of the alter schema statement. */ -ObjectAddress +List * AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok) { AlterObjectSchemaStmt *stmt = castNode(AlterObjectSchemaStmt, node); @@ -676,10 +676,10 @@ AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok) } } - ObjectAddress viewAddress = { 0 }; - ObjectAddressSet(viewAddress, RelationRelationId, viewOid); + ObjectAddress *viewAddress = palloc0(sizeof(ObjectAddress)); + ObjectAddressSet(*viewAddress, RelationRelationId, viewOid); - return viewAddress; + return list_make1(viewAddress); } diff --git a/src/backend/distributed/deparser/objectaddress.c b/src/backend/distributed/deparser/objectaddress.c index a9f1663bc..123445c23 100644 --- a/src/backend/distributed/deparser/objectaddress.c +++ b/src/backend/distributed/deparser/objectaddress.c @@ -33,11 +33,23 @@ GetObjectAddressFromParseTree(Node *parseTree, bool missing_ok) ereport(ERROR, (errmsg("unsupported statement to get object address for"))); } - return ops->address(parseTree, missing_ok); + List *objectAddresses = ops->address(parseTree, missing_ok); + + if (list_length(objectAddresses) > 1) + { + ereport(ERROR, (errmsg( + "citus does not support multiple object addresses in GetObjectAddressFromParseTree"))); + } + + Assert(list_length(objectAddresses) == 1); + + ObjectAddress *objectAddress = linitial(objectAddresses); + + return *objectAddress; } -ObjectAddress +List * RenameAttributeStmtObjectAddress(Node *node, bool missing_ok) { RenameStmt *stmt = castNode(RenameStmt, node); @@ -67,11 +79,11 @@ RenameAttributeStmtObjectAddress(Node *node, bool missing_ok) * Never returns NULL, but the objid in the address could be invalid if missing_ok was set * to true. */ -ObjectAddress +List * CreateExtensionStmtObjectAddress(Node *node, bool missing_ok) { CreateExtensionStmt *stmt = castNode(CreateExtensionStmt, node); - ObjectAddress address = { 0 }; + ObjectAddress *address = palloc0(sizeof(ObjectAddress)); const char *extensionName = stmt->extname; @@ -85,7 +97,7 @@ CreateExtensionStmtObjectAddress(Node *node, bool missing_ok) extensionName))); } - ObjectAddressSet(address, ExtensionRelationId, extensionoid); + ObjectAddressSet(*address, ExtensionRelationId, extensionoid); - return address; + return list_make1(address); } diff --git a/src/include/distributed/commands.h b/src/include/distributed/commands.h index 370810cfa..0bc565aff 100644 --- a/src/include/distributed/commands.h +++ b/src/include/distributed/commands.h @@ -63,7 +63,7 @@ typedef struct DistributeObjectOps void (*qualify)(Node *); List * (*preprocess)(Node *, const char *, ProcessUtilityContext); List * (*postprocess)(Node *, const char *); - ObjectAddress (*address)(Node *, bool); + List * (*address)(Node *, bool); bool markDistributed; /* fields used by common implementations, omitted for specialized implementations */ @@ -159,24 +159,24 @@ extern bool CallDistributedProcedureRemotely(CallStmt *callStmt, DestReceiver *d /* collation.c - forward declarations */ extern char * CreateCollationDDL(Oid collationId); extern List * CreateCollationDDLsIdempotent(Oid collationId); -extern ObjectAddress AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok); -extern ObjectAddress RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok); -extern ObjectAddress AlterCollationSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); +extern List * AlterCollationOwnerObjectAddress(Node *stmt, bool missing_ok); +extern List * RenameCollationStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * AlterCollationSchemaStmtObjectAddress(Node *stmt, + bool missing_ok); extern char * GenerateBackupNameForCollationCollision(const ObjectAddress *address); -extern ObjectAddress DefineCollationStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * DefineCollationStmtObjectAddress(Node *stmt, bool missing_ok); /* database.c - forward declarations */ -extern ObjectAddress AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok); +extern List * AlterDatabaseOwnerObjectAddress(Node *node, bool missing_ok); extern List * DatabaseOwnerDDLCommands(const ObjectAddress *address); /* domain.c - forward declarations */ -extern ObjectAddress CreateDomainStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress AlterDomainStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress DomainRenameConstraintStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress RenameDomainStmtObjectAddress(Node *node, bool missing_ok); +extern List * CreateDomainStmtObjectAddress(Node *node, bool missing_ok); +extern List * AlterDomainStmtObjectAddress(Node *node, bool missing_ok); +extern List * DomainRenameConstraintStmtObjectAddress(Node *node, + bool missing_ok); +extern List * AlterDomainOwnerStmtObjectAddress(Node *node, bool missing_ok); +extern List * RenameDomainStmtObjectAddress(Node *node, bool missing_ok); extern CreateDomainStmt * RecreateDomainStmt(Oid domainOid); extern Oid get_constraint_typid(Oid conoid); @@ -208,10 +208,10 @@ extern List * PreprocessAlterExtensionContentsStmt(Node *node, ProcessUtilityContext processUtilityContext); extern List * CreateExtensionDDLCommand(const ObjectAddress *extensionAddress); -extern ObjectAddress AlterExtensionSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); -extern ObjectAddress AlterExtensionUpdateStmtObjectAddress(Node *stmt, - bool missing_ok); +extern List * AlterExtensionSchemaStmtObjectAddress(Node *stmt, + bool missing_ok); +extern List * AlterExtensionUpdateStmtObjectAddress(Node *stmt, + bool missing_ok); extern void CreateExtensionWithVersion(char *extname, char *extVersion); extern void AlterExtensionUpdateStmt(char *extname, char *extVersion); extern int GetExtensionVersionNumber(char *extVersion); @@ -263,11 +263,11 @@ extern Acl * GetPrivilegesForFDW(Oid FDWOid); extern List * PreprocessGrantOnForeignServerStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern ObjectAddress CreateForeignServerStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress AlterForeignServerStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress RenameForeignServerStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress AlterForeignServerOwnerStmtObjectAddress(Node *node, bool - missing_ok); +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 * AlterForeignServerOwnerStmtObjectAddress(Node *node, bool + missing_ok); extern List * GetForeignServerCreateDDLCommand(Oid serverId); @@ -282,26 +282,26 @@ extern List * PreprocessCreateFunctionStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessCreateFunctionStmt(Node *stmt, const char *queryString); -extern ObjectAddress CreateFunctionStmtObjectAddress(Node *stmt, - bool missing_ok); -extern ObjectAddress DefineAggregateStmtObjectAddress(Node *stmt, - bool missing_ok); +extern List * CreateFunctionStmtObjectAddress(Node *stmt, + bool missing_ok); +extern List * DefineAggregateStmtObjectAddress(Node *stmt, + bool missing_ok); extern List * PreprocessAlterFunctionStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); -extern ObjectAddress AlterFunctionStmtObjectAddress(Node *stmt, - bool missing_ok); -extern ObjectAddress RenameFunctionStmtObjectAddress(Node *stmt, - bool missing_ok); -extern ObjectAddress AlterFunctionOwnerObjectAddress(Node *stmt, - bool missing_ok); -extern ObjectAddress AlterFunctionSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); +extern List * AlterFunctionStmtObjectAddress(Node *stmt, + bool missing_ok); +extern List * RenameFunctionStmtObjectAddress(Node *stmt, + bool missing_ok); +extern List * AlterFunctionOwnerObjectAddress(Node *stmt, + bool missing_ok); +extern List * AlterFunctionSchemaStmtObjectAddress(Node *stmt, + bool missing_ok); extern List * PreprocessAlterFunctionDependsStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); -extern ObjectAddress AlterFunctionDependsStmtObjectAddress(Node *stmt, - bool missing_ok); +extern List * AlterFunctionDependsStmtObjectAddress(Node *stmt, + bool missing_ok); extern List * PreprocessGrantOnFunctionStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessGrantOnFunctionStmt(Node *node, const char *queryString); @@ -340,7 +340,7 @@ extern List * ExecuteFunctionOnEachTableIndex(Oid relationId, PGIndexProcessor extern bool IsReindexWithParam_compat(ReindexStmt *stmt, char *paramName); /* objectaddress.c - forward declarations */ -extern ObjectAddress CreateExtensionStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * CreateExtensionStmtObjectAddress(Node *stmt, bool missing_ok); /* policy.c - forward declarations */ @@ -376,10 +376,10 @@ extern List * PostprocessAlterRoleStmt(Node *stmt, const char *queryString); extern List * PreprocessAlterRoleSetStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * GenerateAlterRoleSetCommandForRole(Oid roleid); -extern ObjectAddress AlterRoleStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterRoleSetStmtObjectAddress(Node *node, - bool missing_ok); +extern List * AlterRoleStmtObjectAddress(Node *node, + bool missing_ok); +extern List * AlterRoleSetStmtObjectAddress(Node *node, + bool missing_ok); extern List * PreprocessCreateRoleStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PreprocessDropRoleStmt(Node *stmt, const char *queryString, @@ -388,7 +388,7 @@ extern List * PreprocessGrantRoleStmt(Node *stmt, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessGrantRoleStmt(Node *stmt, const char *queryString); extern List * GenerateCreateOrAlterRoleCommand(Oid roleOid); -ObjectAddress CreateRoleStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * CreateRoleStmtObjectAddress(Node *stmt, bool missing_ok); extern void UnmarkRolesDistributed(List *roles); extern List * FilterDistributedRoles(List *roles); @@ -402,8 +402,8 @@ extern List * PreprocessAlterObjectSchemaStmt(Node *alterObjectSchemaStmt, const char *alterObjectSchemaCommand); extern List * PreprocessGrantOnSchemaStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); -extern ObjectAddress CreateSchemaStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok); +extern List * CreateSchemaStmtObjectAddress(Node *node, bool missing_ok); +extern List * AlterSchemaRenameStmtObjectAddress(Node *node, bool missing_ok); /* sequence.c - forward declarations */ extern List * PreprocessAlterSequenceStmt(Node *node, const char *queryString, @@ -422,10 +422,10 @@ extern List * PreprocessRenameSequenceStmt(Node *node, const char *queryString, extern List * PreprocessGrantOnSequenceStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessGrantOnSequenceStmt(Node *node, const char *queryString); -extern ObjectAddress AlterSequenceStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress AlterSequenceSchemaStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress AlterSequenceOwnerStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress RenameSequenceStmtObjectAddress(Node *node, bool missing_ok); +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 void ErrorIfUnsupportedSeqStmt(CreateSeqStmt *createSeqStmt); extern void ErrorIfDistributedAlterSeqOwnedBy(AlterSeqStmt *alterSeqStmt); extern char * GenerateBackupNameForSequenceCollision(const ObjectAddress *address); @@ -436,7 +436,7 @@ extern void RenameExistingSequenceWithDifferentTypeIfExists(RangeVar *sequence, extern List * PreprocessCreateStatisticsStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessCreateStatisticsStmt(Node *node, const char *queryString); -extern ObjectAddress CreateStatisticsStmtObjectAddress(Node *node, bool missingOk); +extern List * CreateStatisticsStmtObjectAddress(Node *node, bool missingOk); extern List * PreprocessDropStatisticsStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PreprocessAlterStatisticsRenameStmt(Node *node, const char *queryString, @@ -446,7 +446,7 @@ extern List * PreprocessAlterStatisticsSchemaStmt(Node *node, const char *queryS ProcessUtilityContext processUtilityContext); extern List * PostprocessAlterStatisticsSchemaStmt(Node *node, const char *queryString); -extern ObjectAddress AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk); +extern List * AlterStatisticsSchemaStmtObjectAddress(Node *node, bool missingOk); extern List * PreprocessAlterStatisticsStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PreprocessAlterStatisticsOwnerStmt(Node *node, const char *queryString, @@ -487,8 +487,8 @@ extern void ErrorUnsupportedAlterTableAddColumn(Oid relationId, AlterTableCmd *c extern void ErrorIfUnsupportedConstraint(Relation relation, char distributionMethod, char referencingReplicationModel, Var *distributionColumn, uint32 colocationId); -extern ObjectAddress AlterTableSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); +extern List * AlterTableSchemaStmtObjectAddress(Node *stmt, + bool missing_ok); extern List * MakeNameListFromRangeVar(const RangeVar *rel); extern Oid GetSequenceOid(Oid relationId, AttrNumber attnum); extern bool ConstrTypeUsesIndex(ConstrType constrType); @@ -499,30 +499,30 @@ extern List * GetCreateTextSearchConfigStatements(const ObjectAddress *address); extern List * GetCreateTextSearchDictionaryStatements(const ObjectAddress *address); extern List * CreateTextSearchConfigDDLCommandsIdempotent(const ObjectAddress *address); extern List * CreateTextSearchDictDDLCommandsIdempotent(const ObjectAddress *address); -extern ObjectAddress CreateTextSearchConfigurationObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress CreateTextSearchDictObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress RenameTextSearchConfigurationStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress RenameTextSearchDictionaryStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterTextSearchConfigurationStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterTextSearchDictionaryStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress TextSearchConfigurationCommentObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress TextSearchDictCommentObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterTextSearchConfigurationOwnerObjectAddress(Node *node, - bool missing_ok); -extern ObjectAddress AlterTextSearchDictOwnerObjectAddress(Node *node, - bool missing_ok); +extern List * CreateTextSearchConfigurationObjectAddress(Node *node, + bool missing_ok); +extern List * CreateTextSearchDictObjectAddress(Node *node, + bool missing_ok); +extern List * RenameTextSearchConfigurationStmtObjectAddress(Node *node, + bool missing_ok); +extern List * RenameTextSearchDictionaryStmtObjectAddress(Node *node, + bool missing_ok); +extern List * AlterTextSearchConfigurationStmtObjectAddress(Node *node, + bool missing_ok); +extern List * AlterTextSearchDictionaryStmtObjectAddress(Node *node, + bool missing_ok); +extern List * AlterTextSearchConfigurationSchemaStmtObjectAddress(Node *node, + bool missing_ok); +extern List * AlterTextSearchDictionarySchemaStmtObjectAddress(Node *node, + bool missing_ok); +extern List * TextSearchConfigurationCommentObjectAddress(Node *node, + bool missing_ok); +extern List * TextSearchDictCommentObjectAddress(Node *node, + bool missing_ok); +extern List * AlterTextSearchConfigurationOwnerObjectAddress(Node *node, + bool missing_ok); +extern List * AlterTextSearchDictOwnerObjectAddress(Node *node, + bool missing_ok); extern char * GenerateBackupNameForTextSearchConfiguration(const ObjectAddress *address); extern char * GenerateBackupNameForTextSearchDict(const ObjectAddress *address); extern List * get_ts_config_namelist(Oid tsconfigOid); @@ -535,16 +535,16 @@ extern List * PreprocessRenameTypeAttributeStmt(Node *stmt, const char *queryStr ProcessUtilityContext processUtilityContext); extern Node * CreateTypeStmtByObjectAddress(const ObjectAddress *address); -extern ObjectAddress CompositeTypeStmtObjectAddress(Node *stmt, bool missing_ok); -extern ObjectAddress CreateEnumStmtObjectAddress(Node *stmt, bool missing_ok); -extern ObjectAddress AlterTypeStmtObjectAddress(Node *stmt, bool missing_ok); -extern ObjectAddress AlterEnumStmtObjectAddress(Node *stmt, bool missing_ok); -extern ObjectAddress RenameTypeStmtObjectAddress(Node *stmt, bool missing_ok); -extern ObjectAddress AlterTypeSchemaStmtObjectAddress(Node *stmt, - bool missing_ok); -extern ObjectAddress RenameTypeAttributeStmtObjectAddress(Node *stmt, - bool missing_ok); -extern ObjectAddress AlterTypeOwnerObjectAddress(Node *stmt, bool missing_ok); +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 * AlterTypeSchemaStmtObjectAddress(Node *stmt, + bool missing_ok); +extern List * RenameTypeAttributeStmtObjectAddress(Node *stmt, + bool missing_ok); +extern List * AlterTypeOwnerObjectAddress(Node *stmt, bool missing_ok); extern List * CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress); extern char * GenerateBackupNameForTypeCollision(const ObjectAddress *address); @@ -565,8 +565,8 @@ 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 ObjectAddress ViewStmtObjectAddress(Node *node, bool missing_ok); -extern ObjectAddress AlterViewStmtObjectAddress(Node *node, bool missing_ok); +extern List * ViewStmtObjectAddress(Node *node, bool missing_ok); +extern List * AlterViewStmtObjectAddress(Node *node, bool missing_ok); extern List * PreprocessDropViewStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern char * CreateViewDDLCommand(Oid viewOid); @@ -582,11 +582,11 @@ 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 ObjectAddress RenameViewStmtObjectAddress(Node *node, bool missing_ok); +extern List * RenameViewStmtObjectAddress(Node *node, bool missing_ok); extern List * PreprocessAlterViewSchemaStmt(Node *node, const char *queryString, ProcessUtilityContext processUtilityContext); extern List * PostprocessAlterViewSchemaStmt(Node *node, const char *queryString); -extern ObjectAddress AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok); +extern List * AlterViewSchemaStmtObjectAddress(Node *node, bool missing_ok); extern bool IsViewRenameStmt(RenameStmt *renameStmt); /* trigger.c - forward declarations */ @@ -594,7 +594,7 @@ 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 ObjectAddress CreateTriggerStmtObjectAddress(Node *node, bool missingOk); +extern List * CreateTriggerStmtObjectAddress(Node *node, bool missingOk); 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 f036d7ea8..f3bdb19b2 100644 --- a/src/include/distributed/deparser.h +++ b/src/include/distributed/deparser.h @@ -149,7 +149,7 @@ extern char * GetTypeNamespaceNameByNameList(List *names); extern Oid TypeOidGetNamespaceOid(Oid typeOid); extern ObjectAddress GetObjectAddressFromParseTree(Node *parseTree, bool missing_ok); -extern ObjectAddress RenameAttributeStmtObjectAddress(Node *stmt, bool missing_ok); +extern List * RenameAttributeStmtObjectAddress(Node *stmt, bool missing_ok); /* forward declarations for deparse_view_stmts.c */ extern void QualifyDropViewStmt(Node *node);