postgres.git / summary / log / commit / refs
commit 16a56774fade2da2f44f9f6d6899a8113d5725fc
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue Nov 02 17:36:47 2021 +0000
Fix variable lifespan in ExecInitCoerceToDomain().
This undoes a mistake in 1ec7679f1: domainval and domainnull were
meant to live across loop iterations, but they were incorrectly
moved inside the loop. The effect was only to emit useless extra
EEOP_MAKE_READONLY steps, so it's not a big deal; nonetheless,
back-patch to v13 where the mistake was introduced.
Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAqXuhbkaAp-sGH6dR6Nsq7v28_0TPexHOm6FiDYqwQD-w@mail.gmail.com
src/backend/executor/execExpr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index bd4e4956aa1..954a6b9438d 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -3121,6 +3121,8 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest,
ExprState *state, Datum *resv, bool *resnull)
{
DomainConstraintRef *constraint_ref;
+ Datum *domainval = NULL;
+ bool *domainnull = NULL;
ListCell *l;
scratch->d.domaincheck.resulttype = ctest->resulttype;
@@ -3167,8 +3169,6 @@ ExecInitCoerceToDomain(ExprEvalStep *scratch, CoerceToDomain *ctest,
foreach(l, constraint_ref->constraints)
{
DomainConstraintState *con = (DomainConstraintState *) lfirst(l);
- Datum *domainval = NULL;
- bool *domainnull = NULL;
Datum *save_innermost_domainval;
bool *save_innermost_domainnull;
[parent: 08cfa5981e17]