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

From: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints
Date: 2025-02-12 11:22:36
Message-ID: CAGPqQf0MyqYL_8_ikEyMTE4pKt_692fAwpJvOn1s6rCB_=2B4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 10, 2025 at 10:48 PM Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
wrote:

> Hi Alvaro,
>
> I have incorporated the suggested changes, and here is the latest version
> of the patch:
>
> - Added more test cases to the regression suite.
> - Included tests in the pg_dump test.
> - Left objects with *INVALID NOT NULL* for pg_upgrade.
> - Fixed an issue where recursion to child tables was incorrectly
> attempting to locate the constraint by name.
> - Introduced a new function, QueueNNConstraintValidation(), for
> handling *NOT NULL* constraints.
>
> The only remaining task for this patch is updating the documentation. I
> will work on that and submit the final version soon.
>

Attaching documentation and tab-complete patch here.

> Please share your review comments.
> Thanks,
>
>
> On Mon, Feb 10, 2025 at 12:28 AM Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
> wrote:
>
>>
>>
>> On Fri, Feb 7, 2025 at 4:44 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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
>>
>
>
> --
> Rushabh Lathia
> www.EnterpriseDB.com
>

--
Rushabh Lathia

Attachment Content-Type Size
0004-Documentation-and-tab-complete-for-the-NOT-NULL-NOT-.patch application/octet-stream 2.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-02-12 11:32:11 Re: Add “FOR UPDATE NOWAIT” lock details to the log.
Previous Message Nitin Jadhav 2025-02-12 11:20:34 Re: Address the bug in 041_checkpoint_at_promote.pl