Re: PG19 FK fast path: OOB write and missed FK checks during batched

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Junwang Zhao <zhjwpku(at)gmail(dot)com>, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>, pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>, Andrey Borodin <amborodin(at)acm(dot)org>, Kirk Wolak <wolakk(at)gmail(dot)com>
Subject: Re: PG19 FK fast path: OOB write and missed FK checks during batched
Date: 2026-08-22 07:43:18
Message-ID: CA+HiwqFC3UUvMQbJU1P-C2_RFEs2DpXdMvGKvxrUJnQ1qD11RQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 20, 2026 at 5:34 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Wed, Aug 19, 2026 at 10:12 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > On Wed, Aug 19, 2026 at 12:09 AM Noah Misch <noah(at)leadboat(dot)com> wrote:
> > > On Tue, Aug 18, 2026 at 10:42:14PM +0900, Amit Langote wrote:
> > > > After considering Peter's report of another bug [1] that is fixed by
> > > > 0001, I tested both his reproducer and nested firing involving the
> > > > same constraint.
> > > >
> > > > The latter exposed a problem in v1: the cache was still keyed only by
> > > > constraint OID, so a nested check of the same constraint reused the
> > > > outer entry and did not register a callback at the nested query depth.
> > > > In v2, the key is now (constraint OID, query depth), giving each
> > > > firing level its own entry and callback.
> > > >
> > > > 0001 now includes regression tests for both cases. 0002 and 0003 are unchanged.
> > > >
> > > > I would like to commit these sometime this week and would appreciate a review.
> > >
> > > I won't be able to review this. The list should consider it up for grabs.
> >
> > Attached is v3, rebased over latest master.
> >
> > I reorganized the series to separate firing-state restoration (0001),
> > per-firing-cycle batch and callback scoping that fixes Peter's report
> > [1] (0002), and per-subtransaction batch tracking as suggested by Noah
> > (0003). 0003 also folds in the invariant assertion previously sent
> > separately. The combined code is otherwise unchanged from v2.
> >
> > [1] https://postgr.es/m/CAH2-Wz%3DD533JbF_ak_Pc8kP0FKse-ju8DnMxtjvY%3D%3DyHsP4xgw%40mail.gmail.com
>
> I've now pushed 0001 and 0002. Since they fix live bugs, I decided to
> commit them sooner rather than later.
>
> I plan to commit the attached remaining patch tomorrow, barring
> objections, and then close this item.

Pushed and closed the item.

--
Thanks, Amit Langote

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message 达劳里亚斯 2026-08-22 10:21:27 Re: pg_upgrade --copy-file-range fails with EINVAL on Linux 4.19
Previous Message Michael Paquier 2026-08-22 07:24:35 Re: [PATCH] Fix compilation of nodeMergejoin.c with EXEC_MERGEJOINDEBUG