Re: NOT ENFORCED constraint feature

amul sul <sulamul@gmail.com>

From: Amul Sul <sulamul@gmail.com>
To: Joel Jacobson <joel@compiler.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-11-04T12:17:27Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add support for NOT ENFORCED in foreign key constraints

  2. Expand test a bit

  3. refactor: Pass relation OID instead of Relation to createForeignKeyCheckTriggers()

  4. refactor: Split ATExecAlterConstraintInternal()

  5. refactor: Move some code that updates pg_constraint to a separate function

  6. Move RemoveInheritedConstraint() call slightly earlier

  7. refactor: Split tryAttachPartitionForeignKey()

  8. refactor: re-add ATExecAlterChildConstr()

  9. Add ATAlterConstraint struct for ALTER .. CONSTRAINT

  10. refactor: split ATExecAlterConstrRecurse()

  11. Add support for NOT ENFORCED in CHECK constraints

Attachments

On Tue, Oct 15, 2024 at 10:00 AM Amul Sul <sulamul@gmail.com> wrote:
>
> On Wed, Oct 9, 2024 at 2:44 PM Joel Jacobson <joel@compiler.org> wrote:
> >
> > On Tue, Oct 8, 2024, at 11:06, Amul Sul wrote:
> > > The attached patch proposes adding the ability to define CHECK and
> > > FOREIGN KEY constraints as NOT ENFORCED.
> >
> > Thanks for working on this!
> >
> > > Adding NOT ENFORCED to CHECK constraints is simple, see 0001 patch,
> >
> > I've looked at the 0001 patch and think it looks simple and straight forward.
> >
>
> Thanks for looking into it.
>
> > > but implementing it for FOREIGN KEY constraints requires more code due
> > > to triggers, see 0002 - 0005 patches.
> >
> > I can't say that much yet about the code changes in 0002 - 0005 yet,
> > but I've tested the patches and successfully experimented with the feature.
> >
> > Also think the documentation is good and sound. Only found a minor typo:
> > -    Adding a enforced <literal>CHECK</literal> or <literal>NOT NULL</literal>
> > +    Adding an enforced <literal>CHECK</literal> or <literal>NOT NULL</literal>
> >
>
> Ok, will fix it in the next version.

Attached is the rebased version on the latest master(5b0c46ea093),
including the aforesaid fix.

Regards,
Amul