Re: Segfault due to NULL ParamExecData value

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-12-04T15:35:36Z
Lists: pgsql-bugs
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> writes:
> So it looks like the ParamExec for the InitPlan 5 was correctly executed
> (since execPlan is null) and the value was probably used during the first
> two updates. But for the third update, the ParamExecData's value was null
> leading to the segfault.
> All coredumps (or rather WAL records) show a similar pattern of 2 updates
> before segfaults.
> I haven't been able to reproduce the segfault so I wasn't able to pinpoint
> what could have set ParamExecData's value to null.

I'm not volunteering to look into this without a reproducer.
However, seeing that EvalPlanQual is in the stack trace,
my gut feeling is that the EPQ mechanism is somehow mis-managing
output Params for InitPlans.  I vaguely recall some definitional
issues around whether it'd be okay to pass down already-computed
InitPlan results into the EPQ sub-evaluation, or whether we should
force the sub-evaluation to do those afresh.  It was awhile back
and I don't remember what was decided.

Don't suppose you can try to reproduce this on something newer
than 14.17?

			regards, tom lane