mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Assert that partition inherits from only one parent in MergeAttributes()
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 <ashutosh.bapat.oss@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com
This commit is contained in:
parent
58b20e6d75
commit
d22d98c341
@ -2721,6 +2721,12 @@ MergeAttributes(List *columns, const List *supers, char relpersistence,
|
|||||||
int32 deftypmod;
|
int32 deftypmod;
|
||||||
Oid defCollId;
|
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.
|
* Yes, try to merge the two column definitions.
|
||||||
*/
|
*/
|
||||||
@ -2792,12 +2798,9 @@ MergeAttributes(List *columns, const List *supers, char relpersistence,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* In regular inheritance, columns in the parent's primary key
|
* In regular inheritance, columns in the parent's primary key
|
||||||
* get an extra not-null constraint. Partitioning doesn't
|
* get an extra not-null constraint.
|
||||||
* need this, because the PK itself is going to be cloned to
|
|
||||||
* the partition.
|
|
||||||
*/
|
*/
|
||||||
if (!is_partition &&
|
if (bms_is_member(parent_attno - FirstLowInvalidHeapAttributeNumber,
|
||||||
bms_is_member(parent_attno - FirstLowInvalidHeapAttributeNumber,
|
|
||||||
pkattrs))
|
pkattrs))
|
||||||
{
|
{
|
||||||
CookedConstraint *nn;
|
CookedConstraint *nn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user