diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c index 6b35111ebb6..21b10d29a50 100644 --- a/src/backend/partitioning/partbounds.c +++ b/src/backend/partitioning/partbounds.c @@ -673,7 +673,11 @@ create_list_bounds(PartitionBoundSpec **boundspecs, int nparts, /* All partitions must now have been assigned canonical indexes. */ - Assert(next_index == nparts); + if (next_index != nparts) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("not all partitions assigned canonical indexes"))); + return boundinfo; } @@ -888,7 +892,11 @@ create_range_bounds(PartitionBoundSpec **boundspecs, int nparts, boundinfo->indexes[i] = -1; /* All partitions must now have been assigned canonical indexes. */ - Assert(next_index == nparts); + if (next_index != nparts) + ereport(ERROR, + (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), + errmsg("not all partitions assigned canonical indexes"))); + return boundinfo; }