Re: NOT ENFORCED constraint feature

From: Amul Sul <sulamul(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Joel Jacobson <joel(at)compiler(dot)org>, Alexandra Wang <alexandra(dot)wang(dot)oss(at)gmail(dot)com>, Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>
Subject: Re: NOT ENFORCED constraint feature
Date: 2025-03-21 05:58:44
Message-ID: CAAJ_b97aHsJgWhAuRQi1JdWsjzd_ygWEjqQVq_Ddo8dyCnnwkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 19, 2025 at 12:33 AM Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2025-Mar-12, Amul Sul wrote:
>
> > On Tue, Mar 11, 2025 at 11:13 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> > > I think the next step here is that you work to fix Álvaro's concerns
> > > about the recursion structure.
> >
> > Yes, I worked on that in the attached version. I refactored
> > ATExecAlterConstraintInternal() and moved the code that updates the
> > pg_constraint entry into a separate function (see 0001), so it can be
> > called from the places where the entry needs to be updated, rather
> > than revisiting ATExecAlterConstraintInternal(). In 0002,
> > ATExecAlterConstraintInternal() is split into two functions:
> > ATExecAlterConstrDeferrability() and
> > ATExecAlterConstrInheritability(), which handle altering deferrability
> > and inheritability, respectively. These functions are expected to
> > recurse on themselves, rather than revisiting
> > ATExecAlterConstraintInternal() as before. This approach simplifies
> > things. Similarly can add ATExecAlterConstrEnforceability() which
> > recurses itself.
>
> Yeah, I gave this a look and I think this code layout is good. There
> are more functions now, but the code flow is simpler.
>

Thank you !

Attached is the updated version, where the commit messages for patch
0005 and 0006 have been slightly corrected. Additionally, a few code
comments have been updated to consistently use the ENFORCED/NOT
ENFORCED keywords. The rest of the patches and all the code are
unchanged.

Regards,
Amul

Attachment Content-Type Size
v18-0001-refactor-move-code-updates-pg_constraint-entry-i.patch application/octet-stream 3.8 KB
v18-0002-refactor-Split-ATExecAlterConstraintInternal.patch application/octet-stream 12.8 KB
v18-0003-refactor-Pass-Relid-instead-of-Relation-to-creat.patch application/octet-stream 3.3 KB
v18-0004-Remove-hastriggers-flag-check-before-fetching-FK.patch application/octet-stream 10.8 KB
v18-0005-Add-support-for-NOT-ENFORCED-in-foreign-key-cons.patch application/octet-stream 67.4 KB
v18-0006-Merge-the-parent-and-child-constraints-with-diff.patch application/octet-stream 27.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yuki Seino 2025-03-21 06:21:57 Re: Add “FOR UPDATE NOWAIT” lock details to the log.
Previous Message Michael Paquier 2025-03-21 05:53:12 Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible