diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c index 32e70ca580..4a7bc64e79 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -37,6 +37,7 @@ #include "access/hash.h" #include "access/nbtree.h" +#include "catalog/pg_class.h" #include "catalog/pg_operator.h" #include "catalog/pg_opfamily.h" #include "catalog/pg_type.h" @@ -212,6 +213,8 @@ make_partition_pruneinfo(PlannerInfo *root, RelOptInfo *parentrel, List *prunerelinfos; int i; + Assert(IS_SIMPLE_REL(parentrel)); + /* * Construct a temporary array to map from planner relids to subplan * indexes. For convenience, we use 1-based indexes here, so that zero @@ -283,6 +286,9 @@ make_partition_pruneinfo(PlannerInfo *root, RelOptInfo *parentrel, { Bitmapset *other_subplans; + Assert(root->simple_rte_array[parentrel->relid]->relkind != + RELKIND_PARTITIONED_TABLE); + /* Create the complement of allmatchedsubplans */ other_subplans = bms_add_range(NULL, 0, list_length(subpaths) - 1); other_subplans = bms_del_members(other_subplans, allmatchedsubplans); @@ -347,8 +353,6 @@ make_partitionedrel_pruneinfo(PlannerInfo *root, RelOptInfo *parentrel, Assert(rti < root->simple_rel_array_size); /* No duplicates please */ Assert(relid_subpart_map[rti] == 0); - /* Same rel cannot be both leaf and non-leaf */ - Assert(relid_subplan_map[rti] == 0); relid_subpart_map[rti] = i++; }