Create wrapper function CreateObjectAddressDependencyDefList (#5623)

pull/5626/head
Ahmet Gedemenli 2022-01-17 15:35:40 +03:00 committed by GitHub
parent 4dca662e97
commit 8936543b80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 10 deletions

View File

@ -123,6 +123,7 @@ typedef struct ViewDependencyNode
static List * GetRelationTriggerFunctionDepencyList(Oid relationId);
static List * GetRelationStatsSchemaDependencyList(Oid relationId);
static DependencyDefinition * CreateObjectAddressDependencyDef(Oid classId, Oid objectId);
static List * CreateObjectAddressDependencyDefList(Oid classId, List *objectIdList);
static ObjectAddress DependencyDefinitionObjectAddress(DependencyDefinition *definition);
/* forward declarations for functions to interact with the ObjectAddressCollector */
@ -1003,18 +1004,9 @@ ExpandCitusSupportedTypes(ObjectAddressCollector *collector, ObjectAddress targe
static List *
GetRelationStatsSchemaDependencyList(Oid relationId)
{
List *dependencyList = NIL;
List *schemaIds = GetExplicitStatisticsSchemaIdList(relationId);
Oid schemaId = InvalidOid;
foreach_oid(schemaId, schemaIds)
{
DependencyDefinition *dependency =
CreateObjectAddressDependencyDef(NamespaceRelationId, schemaId);
dependencyList = lappend(dependencyList, dependency);
}
return dependencyList;
return CreateObjectAddressDependencyDefList(NamespaceRelationId, schemaIds);
}
@ -1056,6 +1048,27 @@ CreateObjectAddressDependencyDef(Oid classId, Oid objectId)
}
/*
* CreateObjectAddressDependencyDefList is a wrapper function for
* CreateObjectAddressDependencyDef to operate on a list of relation oids,
* instead of a single oid.
*/
static List *
CreateObjectAddressDependencyDefList(Oid classId, List *objectIdList)
{
List *dependencyList = NIL;
Oid objectId = InvalidOid;
foreach_oid(objectId, objectIdList)
{
DependencyDefinition *dependency =
CreateObjectAddressDependencyDef(classId, objectId);
dependencyList = lappend(dependencyList, dependency);
}
return dependencyList;
}
/*
* DependencyDefinitionObjectAddress returns the object address of the dependency defined
* by the dependency definition, irregardless what the source of the definition is