Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints

From: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints
Date: 2025-02-06 12:38:46
Message-ID: CAGPqQf0KitkNack4F5CFkFi-9Dqvp29Ro=EpcWt=4_hs-Rt+bQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Commit 14e87ffa5c543b5f30ead7413084c25f7735039f
<https://github.com/postgres/postgres/commit/14e87ffa5c543b5f30ead7413084c25f7735039f>
added
the support for named NOT NULL constraints. We can now support the NOT
VALID/VALID named NOT NULL constraints.

This patch supports the NOT VALID and VALIDATE CONSTRAINT for name NOT NULL
constraints. In order to achieve this patch,

1) Converted the pg_attribute.attnotnull to CHAR type, so that it can hold
the INVALID flag for the constraint.
2) Added the support for NOT VALID as well as VALIDATE CONSTRAINT support.
3) Support for pg_dump, where we now dumping the INVALID NOT NULL as
separate from table schemes, just like CHECK Constraints.
4) Added related testcases.

Attaching the patch here.

Thanks Alvaro for your offline help and support for this feature.

Thanks
Rushabh Lathia
www.EnterpriseDB.com

Attachment Content-Type Size
0003-Support-pg_dump-to-dump-NOT-VALID-named-NOT-NULL-con.patch application/octet-stream 10.8 KB
0002-Support-NOT-VALID-and-VALIDATE-CONSTRAINT-for-named-.patch application/octet-stream 20.7 KB
0001-Convert-pg_attribut.attnotnull-to-char-type.patch application/octet-stream 19.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2025-02-06 12:39:05 Re: Show WAL write and fsync stats in pg_stat_io
Previous Message Nazir Bilal Yavuz 2025-02-06 12:19:00 Re: Show WAL write and fsync stats in pg_stat_io