Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>,
jian he <jian.universality@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>,
Rushabh Lathia <rushabh.lathia@gmail.com>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-04-03T08:01:15Z
Lists: pgsql-hackers
It occurred to me that we will also want to have NOT NULL NOT ENFORCED constraints eventually. As we have discussed elsewhere, the NOT ENFORCED state is closely related to the NOT VALID state. So that should probably be considered in the design here. Reading up on this again now, I'm confused about putting the NOT VALID state for not-null constraints into pg_attribute. We have catalogued not-null constraints now, so we can put metadata for them into pg_constraint! And we have NOT VALID and NOT ENFORCED flags in pg_constraint already. So what is the purpose of the attnotnullvalid field? In the latest posted patch, I don't see this column used in the executor for the actual constraint checking. So is this all merely for clients to understand the constraint metadata? If we add more metadata for not-null constraints, do we need to add a new pg_attribute flag for each one? That doesn't seem right.
Commits
-
Allow NOT NULL constraints to be added as NOT VALID
- a379061a22a8 18.0 landed
-
Add missing deparsing of [NO] IDENT to XMLSERIALIZE()
- 984410b92326 18.0 cited
-
backend launchers void * arguments for binary data
- 7202d72787d3 18.0 cited
-
Add pg_constraint rows for not-null constraints
- 14e87ffa5c54 18.0 cited
-
Create the infrastructure for planner support functions.
- 1fb57af92069 12.0 cited
-
Add prokind column, replacing proisagg and proiswindow
- fd1a421fe661 11.0 cited