Hi All, I have created a regular table with CHECK constraint on the partition key column and it conflicts with the partition constraint but, still, i could attach the table with the partitioned table. Here is what i am trying to do,
postgres[76308]=# create table part_tab (b int, a int) partition by range (a); CREATE TABLE postgres[76308]=# create table part1 (a int, b int CHECK (a >= 5)); CREATE TABLE postgres[76308]=# alter table part_tab attach partition part1 for values from (0) to (5); -- the partition constraint applied here conflicts with CHECK (a >= 5) applied on part1. ALTER TABLE postgres[76308]=# \d+ part1; Table "public.part1" +--------+---------+-----------+----------+---------+---------+--------------+-------------+ | Column | Type | Collation | Nullable | Default | Storage | Stats target | Description | +--------+---------+-----------+----------+---------+---------+--------------+-------------+ | a | integer | | | | plain | | | | b | integer | | | | plain | | | +--------+---------+-----------+----------+---------+---------+--------------+-------------+ Partition of: part_tab FOR VALUES FROM (0) TO (5) Partition constraint: ((a IS NOT NULL) AND (a >= 0) AND (a < 5)) Check constraints: "part1_a_check" CHECK (a >= 5) Options: storage_engine=zheap As shown in the description of part1 (child table) above, Partition constraint i.e. (a >= 0) AND (a < 5) and the CHECK constraint a >= 5 conflicts with each other but still alter table ... attach partition succeeded. Isn't that a bug? -- With Regards, Ashutosh Sharma EnterpriseDB:http://www.enterprisedb.com