Re: Re: [PATCH] Fix segmentation fault caused by reentrancy in RI_Fkey_cascade_del (ri_triggers.c)

From: Lucas Jeffrey <lucas(dot)jeffrey(at)anachronics(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>, Trakshan Mishra <trakshanmishra477(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Andrés Krüger <andres(dot)kruger(at)anachronics(dot)com>, Rodolfo Campero <rodolfo(dot)campero(at)anachronics(dot)com>
Subject: Re: Re: [PATCH] Fix segmentation fault caused by reentrancy in RI_Fkey_cascade_del (ri_triggers.c)
Date: 2026-10-22 21:01:33
Message-ID: CAGHzy7SJmVQACF_=G+Z=fwoeFbdwJxh-TH_tghxFD82jSxtoLw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit, Trakshan,

Thanks both for the work on this. I've been iterating on Amit's v1 plus
Trakshan's stack, and added error handling on top. Patch attached (v9).

Amit, does the approach used to defer freeing the plans look OK to you?
To keep it conservative I don't free anything while the error is being
handled; maybe that's not needed and we could free them in the
PG_FINALLY instead.

Regards,
Lucas

El jue, 22 oct 2026 a las 8:18, Amit Langote (<amitlangote09(at)gmail(dot)com>)
escribió:

> On Wed, Oct 21, 2026 at 9:02 PM Amit Langote <amitlangote09(at)gmail(dot)com>
> wrote:
> > Thanks for the patch. I'm going to study it and post an updated
> > version tomorrow. I'd like to handle errors as well as Lucas's patch
> > does but I'd stick to using PG_TRY in all the branches instead of
> > resowner in some and PG_TRY in others. I believe subtransaction
> > aborts are handled correctly by PG_TRY-based solution but I'd need to
> > test that. In any case, I want to avoid hash table and resowner calls
> > in the per-row path and keep the tracking code as minimal as possible.
>
> Sorry, ran out of time today, so will post the patch tomorrow.
>
> --
> Thanks, Amit Langote
>

Attachment Content-Type Size
v9-0001-Don-t-free-a-cached-RI-plan-that-may-be-in-use.patch text/x-patch 10.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2026-10-22 23:06:58 Re: PG19: two RI fast-path issues found while testing the batching revert
Previous Message Tom Lane 2026-10-22 20:33:07 Re: [PATCH] Keep git-external-diff usage text from executing