A partition inherits only from one partitioned table and thus inherits
a column definition only once. Assert the same in MergeAttributes()
and simplify a condition accordingly.
Similar definition exists about line 3068 in the same function.
Author: Ashutosh Bapat <
[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com
int32 deftypmod;
Oid defCollId;
+ /*
+ * Partitions have only one parent and have no column
+ * definitions of their own, so conflict should never occur.
+ */
+ Assert(!is_partition);
+
/*
* Yes, try to merge the two column definitions.
*/
/*
* In regular inheritance, columns in the parent's primary key
- * get an extra not-null constraint. Partitioning doesn't
- * need this, because the PK itself is going to be cloned to
- * the partition.
+ * get an extra not-null constraint.
*/
- if (!is_partition &&
- bms_is_member(parent_attno - FirstLowInvalidHeapAttributeNumber,
+ if (bms_is_member(parent_attno - FirstLowInvalidHeapAttributeNumber,
pkattrs))
{
CookedConstraint *nn;