Merge pull request #3857 from citusdata/use_RelationGetPartitionDesc

use RelationGetPartitionDesc to be more safe
pull/3863/head
Philip Dubé 2020-05-29 15:12:57 +00:00 committed by GitHub
commit dca09e998f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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 */