Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints - Mailing list pgsql-hackers

From jian he
Subject Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints
Date
Msg-id CACJufxGC7pZsJFBkU1mUG8vdGGoRQh8otiZkA0aC7bULktBosw@mail.gmail.com
Whole thread Raw
In response to Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints  (Rushabh Lathia <rushabh.lathia@gmail.com>)
Responses Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints
List pgsql-hackers
hi.

CREATE TABLE t (a int, b int);
INSERT INTO t VALUES (NULL, 1), (300, 3);
ALTER TABLE t ADD CONSTRAINT nn NOT NULL a NOT VALID; -- ok
ALTER TABLE t add column c float8 default random();
the last query should not fail.


if we want more places use CompactAttribute->attnullability
set_attnotnull should also set CompactAttribute->attnullability proactively
not waiting CommandCounterIncrement invoke RelationBuildTupleDesc.

another reason:
CheckNNConstraintFetch only handle "if (!conform->convalidated)"
what if the not-null is set conform->convalidated to true,
then RelationBuildTupleDesc doesn't set/change
CompactAttribute->attnullability at all.


attached is all the needed changes after v8-0001, v8-0002, i think.

Attachment

pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: Restrict publishing of partitioned table with a foreign table as partition
Next
From: Amit Kapila
Date:
Subject: Re: Fix 035_standby_logical_decoding.pl race conditions