diff options
Diffstat (limited to 'src/backend/utils/cache/partcache.c')
-rw-r--r-- | src/backend/utils/cache/partcache.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/backend/utils/cache/partcache.c b/src/backend/utils/cache/partcache.c index 07653f312bb..7856b47cdd9 100644 --- a/src/backend/utils/cache/partcache.c +++ b/src/backend/utils/cache/partcache.c @@ -340,15 +340,23 @@ RelationBuildPartitionDesc(Relation rel) oldcxt = MemoryContextSwitchTo(rel->rd_pdcxt); partdesc->boundinfo = partition_bounds_copy(boundinfo, key); partdesc->oids = (Oid *) palloc(partdesc->nparts * sizeof(Oid)); + partdesc->is_leaf = (bool *) palloc(partdesc->nparts * sizeof(bool)); /* * Now assign OIDs from the original array into mapped indexes of the - * result array. Order of OIDs in the former is defined by the catalog - * scan that retrieved them, whereas that in the latter is defined by - * canonicalized representation of the partition bounds. + * result array. The order of OIDs in the former is defined by the + * catalog scan that retrieved them, whereas that in the latter is defined + * by canonicalized representation of the partition bounds. */ for (i = 0; i < partdesc->nparts; i++) - partdesc->oids[mapping[i]] = oids_orig[i]; + { + int index = mapping[i]; + + partdesc->oids[index] = oids_orig[i]; + /* Record if the partition is a leaf partition */ + partdesc->is_leaf[index] = + (get_rel_relkind(oids_orig[i]) != RELKIND_PARTITIONED_TABLE); + } MemoryContextSwitchTo(oldcxt); rel->rd_partdesc = partdesc; |