mirror of https://github.com/citusdata/citus.git
use RelationGetPartitionDesc to be more safe
For getting the partition desc, we should use RelationGetPartitionDesc method so that even if it is NULL, it will be created in the method.pull/3857/head
parent
a3c470b2b8
commit
dec2b28d49
|
@ -287,14 +287,14 @@ PartitionList(Oid parentRelationId)
|
||||||
|
|
||||||
ereport(ERROR, (errmsg("\"%s\" is not a parent table", relationName)));
|
ereport(ERROR, (errmsg("\"%s\" is not a parent table", relationName)));
|
||||||
}
|
}
|
||||||
|
PartitionDesc partDesc = RelationGetPartitionDesc(rel);
|
||||||
|
Assert(partDesc != NULL);
|
||||||
|
|
||||||
Assert(rel->rd_partdesc != NULL);
|
int partitionCount = partDesc->nparts;
|
||||||
|
|
||||||
int partitionCount = rel->rd_partdesc->nparts;
|
|
||||||
for (int partitionIndex = 0; partitionIndex < partitionCount; ++partitionIndex)
|
for (int partitionIndex = 0; partitionIndex < partitionCount; ++partitionIndex)
|
||||||
{
|
{
|
||||||
partitionList =
|
partitionList =
|
||||||
lappend_oid(partitionList, rel->rd_partdesc->oids[partitionIndex]);
|
lappend_oid(partitionList, partDesc->oids[partitionIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* keep the lock */
|
/* keep the lock */
|
||||||
|
|
Loading…
Reference in New Issue