Include IntegerArrayTypeToList from worker_protocol.h instead of array_type.h

On Citus versions <= 11.0, IntegerArrayTypeToList() doesn't exist and
its helpers (DeconstructArrayObject() & ArrayObjectCount()) are defined
in worker_protocol.h. (See 9476f377b5).

So we add IntegerArrayTypeToList() into worker_protocol.c and include
IntegerArrayTypeToList from worker_protocol.h instead of array_type.h
in foreign_constraint.c.

This is needed to backport a868cc049a into
this (release-11.0) branch, see the next commit.
pull/6410/head
Onur Tirtir 2022-09-23 14:14:10 +03:00
parent fcd0bdf370
commit 308f9298d7
2 changed files with 21 additions and 0 deletions

View File

@ -419,6 +419,26 @@ ArrayObjectCount(ArrayType *arrayObject)
}
/*
* Converts ArrayType to List.
*/
List *
IntegerArrayTypeToList(ArrayType *arrayObject)
{
List *list = NULL;
Datum *datumObjectArray = DeconstructArrayObject(arrayObject);
int arrayObjectCount = ArrayObjectCount(arrayObject);
for (int index = 0; index < arrayObjectCount; index++)
{
int32 intObject = DatumGetInt32(datumObjectArray[index]);
list = lappend_int(list, intObject);
}
return list;
}
/*
* InitTaskDirectory creates a job and task directory using given identifiers,
* if these directories do not already exist. The function then returns the task

View File

@ -118,6 +118,7 @@ extern StringInfo InitTaskDirectory(uint64 jobId, uint32 taskId);
extern void RemoveJobSchema(StringInfo schemaName);
extern Datum * DeconstructArrayObject(ArrayType *arrayObject);
extern int32 ArrayObjectCount(ArrayType *arrayObject);
extern List * IntegerArrayTypeToList(ArrayType *arrayObject);
extern FmgrInfo * GetFunctionInfo(Oid typeId, Oid accessMethodId, int16 procedureId);
extern uint64 ExtractShardIdFromTableName(const char *tableName, bool missingOk);
extern void RepartitionCleanupJobDirectories(void);