aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gierth <rhodiumtoad@postgresql.org>2021-01-28 10:53:10 +0000
committerAndrew Gierth <rhodiumtoad@postgresql.org>2021-01-28 11:09:40 +0000
commit75e3cca42d6f1121934d982a9f9efd37226e875d (patch)
tree225cf1dfcbf5a0ae1565d9cf0792baf6e4bc1840
parentbfda0a02444e204024d83db2874ec884960d24f0 (diff)
downloadpostgresql-75e3cca42d6f1121934d982a9f9efd37226e875d.tar.gz
postgresql-75e3cca42d6f1121934d982a9f9efd37226e875d.zip
Don't add bailout adjustment for non-strict deserialize calls.
When building aggregate expression steps, strict checks need a bailout jump for when a null value is encountered, so there is a list of steps that require later adjustment. Adding entries to that list for steps that aren't actually strict would be harmless, except that there is an Assert which catches them. This leads to spurious errors on asserts builds, for data sets that trigger parallel aggregation of an aggregate with a non-strict deserialization function (no such aggregates exist in the core system). Repair by not adding the adjustment entry when it's not needed. Backpatch back to 11 where the code was introduced. Per a report from Darafei (Komzpa) of the PostGIS project; analysis and patch by me. Discussion: https://postgr.es/m/87mty7peb3.fsf@news-spur.riddles.org.uk
-rw-r--r--src/backend/executor/execExpr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 236413f62aa..cbea3e574f6 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -3060,8 +3060,10 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
scratch.resnull = &trans_fcinfo->args[argno + 1].isnull;
ExprEvalPushStep(state, &scratch);
- adjust_bailout = lappend_int(adjust_bailout,
- state->steps_len - 1);
+ /* don't add an adjustment unless the function is strict */
+ if (pertrans->deserialfn.fn_strict)
+ adjust_bailout = lappend_int(adjust_bailout,
+ state->steps_len - 1);
/* restore normal settings of scratch fields */
scratch.resvalue = &state->resvalue;