Prevent setting NO INHERIT on partitioned not-null constraints - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Prevent setting NO INHERIT on partitioned not-null constraints
Date
Msg-id ecc985ad-6ec1-4094-a315-317943ca5f3f@proxel.se
Whole thread
Responses Re: Prevent setting NO INHERIT on partitioned not-null constraints
List pgsql-hackers
Hi!

Me and Joel found a bug when working on another patch. We noticed that 
you cannot create not-null constraints with NO INHEIRT set on 
partitioned tables, but you can actually set it later by using ALTER 
CONSTRAINT. This must be an oversight so I have attached a patch which 
adds a check to prevent this.

The SQL below should give an error but does not:

CREATE TABLE t (
   a int,
   CONSTRAINT a_is_not_null NOT NULL a
) PARTITION BY LIST (a);

ALTER TABLE t ALTER CONSTRAINT a_is_not_null NO INHERIT;

-- 
Andreas Karlsson
Percona

Attachment

pgsql-hackers by date:

Previous
From: Arseniy Mukhin
Date:
Subject: Re: amcheck support for BRIN indexes
Next
From: Alexander Korotkov
Date:
Subject: Re: Fix SPLIT PARTITION bound-overlap bug and other improvements