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

Rushabh Lathia <rushabh.lathia@gmail.com>

From: Rushabh Lathia <rushabh.lathia@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-02-09T18:58:45Z
Lists: pgsql-hackers
On Fri, Feb 7, 2025 at 4:44 PM Alvaro Herrera <alvherre@alvh.no-ip.org>
wrote:

>
> Recursion to child tables is incorrectly trying to locate the constraint
> by name:
>
> create table notnull_tbl1 (a int);
> alter table notnull_tbl1 add constraint foo not null a not valid;
> create table notnull_chld (a int);
> alter table notnull_chld add constraint blah not null a not valid;
> alter table notnull_chld inherit notnull_tbl1 ;
>
> -- this fails but shouldn't:
> alter table notnull_tbl1 validate constraint foo;
> ERROR:  constraint "foo" of relation "notnull_chld" does not exist
>
> The end result here should be that the constraint `blah` in table
> notnull_chld is marked as validated.
>

Yes, I agree.  Here we need a separate Queue for NotNull constraint
validation,
which fetches the respective Non-Validate-Not-Null constraint name from
the child table

I am working on the patch and will post the update patch soon.


>
> --
> Álvaro Herrera               48°01'N 7°57'E  —
> https://www.EnterpriseDB.com/
> Syntax error: function hell() needs an argument.
> Please choose what hell you want to involve.
>


-- 
Rushabh Lathia

Commits

  1. Allow NOT NULL constraints to be added as NOT VALID

  2. Add missing deparsing of [NO] IDENT to XMLSERIALIZE()

  3. backend launchers void * arguments for binary data

  4. Add pg_constraint rows for not-null constraints

  5. Create the infrastructure for planner support functions.

  6. Add prokind column, replacing proisagg and proiswindow