Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash
Date: 2023-02-22 01:17:05
Message-ID: 20230222011705.sv75mkhvmxuqv22l@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2023-02-21 19:00:07 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > Perhaps we should deal with this by generating a distinct type of expression
> > step, that looks up information about the param in a different place? Nothing
> > forces us to have the expression step look into
> > prm = &(econtext->ecxt_param_exec_vals[op->d.param.paramid]);
>
> Right, where I was going was to have a distinct EEOP type that finds
> the ParamExecData in some other way. The main question is where to keep
> that not-so-global ParamExecData.

We currently overwrite prm->execPlan in ExecInitSubPlan(), when creating a
second reference to the subplan. Which is why we then end up using the wrong
SubPlanState in ExecSetParamPlan().

The problem of using the wrong SubPlanState doesn't look too hard to solve: We
could stash the "actual" execPlan in scratch.d.param.something, instead of
looking it up during ExecEvalParamExec().

I think that'd not be quite enough, because due to sharing the same
ParamExecData, we wouldn't know when to recompute the plan.

It also looks like something might not yet quite compute/adjust the types
completely enough in execPartition.c...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2023-02-22 02:55:10 Re: BUG #17789: process_pgfdw_appname() fails for autovacuum workers
Previous Message Michael Paquier 2023-02-22 01:07:58 Re: BUG #17789: process_pgfdw_appname() fails for autovacuum workers