aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-11-02 13:36:47 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-11-02 13:36:47 -0400
commit01fc6527034a6f70ed44a078af8f636b1ab64947 (patch)
tree8626b23823dfd5e4787e9e1483c1261067d654b7 /src/backend/executor
parent7d9ec0754afeabb9f336c5220ef415c3ea27a0b6 (diff)
downloadpostgresql-01fc6527034a6f70ed44a078af8f636b1ab64947.tar.gz
postgresql-01fc6527034a6f70ed44a078af8f636b1ab64947.zip
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
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execExpr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 33ef39e2d4c..892b4e17e09 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -3137,6 +3137,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;
@@ -3183,8 +3185,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;