From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Evaluate arguments of correlated SubPlans in the referencing ExprState
Date: Thu, 02 Mar 2023 14:33:35 -0500
Message-ID: <2129737.1677785615@sss.pgh.pa.us> (raw)
In-Reply-To: <20230225214401.346ancgjqc3zmvek@awork3.anarazel.de>
References: <20230225214401.346ancgjqc3zmvek@awork3.anarazel.de>
Andres Freund <andres@anarazel.de> writes:
> Around
> https://www.postgresql.org/message-id/20230224015417.75yimxbksejpffh3%40awork3.anarazel.de
> I suggested that we should evaluate the arguments of correlated SubPlans as
> part of the expression referencing the subplan.
> Here's a patch for that.
I looked through this, and there is one point that is making me really
uncomfortable. This bit is assuming that we can bind the address of
the es_param_exec_vals array right into the compiled expression:
+ ParamExecData *prm = &estate->es_param_exec_vals[paramid];
+
+ ExecInitExprRec(lfirst(pvar), state, &prm->value, &prm->isnull);
Even if that works today, it'd kill the ability to use the compiled
expression across more than one executor instance, which seems like
a pretty high price. Also, I think it probably fails already in
EvalPlanQual contexts, because EvalPlanQualStart allocates a separate
es_param_exec_vals array for EPQ execution.
I think we'd be better off inventing an EEOP_SET_PARAM_EXEC step type
that is essentially the inverse of EEOP_PARAM_EXEC/ExecEvalParamExec,
and then evaluating each parameter value into the expression's
scratch Datum/isnull fields and emitting SET_PARAM_EXEC to copy those
to the correct ParamExecData slot.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de
Subject: Re: Evaluate arguments of correlated SubPlans in the referencing ExprState
In-Reply-To: <2129737.1677785615@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox