From: | Amul Sul <sulamul(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Joel Jacobson <joel(at)compiler(dot)org> |
Subject: | Re: NOT ENFORCED constraint feature |
Date: | 2025-02-10 06:03:06 |
Message-ID: | CAAJ_b94bfgPV-8Mw_HwSBeheVwaK9=5s+7+KbBj_NpwXQFgDGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Feb 4, 2025 at 7:22 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 03.02.25 06:19, Ashutosh Bapat wrote:
> > Here's how I see the state conversions happening.
> >
> > NOT VALID, NOT ENFORCED changed to NOT_VALID, ENFORCED - no data
> > validation required, constraint is enforced on the new tuples/changes
> > NOT VALID, ENFORCED changed to NOT VALID, NOT ENFORCED - no data
> > validation, constraint isn't enforced anymore
> > VALID, NOT ENFORCED changed to VALID, ENFORCED - data validation
> > required, constraint is enforced
> > VALID, ENFORCED changed to VALID, NOT ENFORCED - no data validation
> > required, constrain isn't enforced anymore, we rely on user to enforce
> > the constraint on their side
>
> This looks sensible to me.
Attached patch implemented this behaviour. To achieve this, we have to
revert (see 0007) some committed code and relax the restriction that
the NOT ENFORCED constraint must also be NOT VALID. Now, NOT ENFORCED
and NOT VALID are independent statuses, and the psql-meta meta command
will display NOT VALID alongside the NOT ENFORCED constraint.
Previously, we hid NOT VALID for NOT ENFORCED constraints, assuming it
would be implied, but that is no longer the case.
Apart from this, I have added a few more tests in 0009. Additionally,
I made some minor code rearrangements in the
AttachPartitionForeignKey() function -- was introduced in the 0002
refactoring patch. I kept these rearrangement changes separate in 0003
to highlight them, allowing the reviewer to identify any potential
issues, though I don't believe there are any. Of course, I could be
wrong.
Also, I need more time for additional testing of the 0008 and 0009
patches, which I plan to complete by the end of this week. Thanks.
Regards,
Amul
Attachment | Content-Type | Size |
---|---|---|
v13-0001-Add-AlterConstraintStmt-struct-for-ALTER-.-CONST.patch | application/x-patch | 6.5 KB |
v13-0002-refactor-Split-tryAttachPartitionForeignKey.patch | application/x-patch | 13.5 KB |
v13-0003-Move-the-RemoveInheritedConstraint-function-call.patch | application/x-patch | 2.7 KB |
v13-0004-refactor-Pass-Relid-instead-of-Relation-to-creat.patch | application/x-patch | 3.3 KB |
v13-0005-refactor-Change-ATExecAlterConstrRecurse-argumen.patch | application/x-patch | 5.3 KB |
v13-0006-Remove-hastriggers-flag-check-before-fetching-FK.patch | application/x-patch | 10.8 KB |
v13-0007-Ease-the-restriction-that-a-NOT-ENFORCED-constra.patch | application/x-patch | 20.7 KB |
v13-0008-Add-support-for-NOT-ENFORCED-in-foreign-key-cons.patch | application/x-patch | 63.4 KB |
v13-0009-Merge-the-parent-and-child-constraints-with-diff.patch | application/x-patch | 28.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2025-02-10 06:09:45 | Re: Introduce XID age and inactive timeout based replication slot invalidation |
Previous Message | Peter Smith | 2025-02-10 06:03:02 | Re: Introduce XID age and inactive timeout based replication slot invalidation |