diff options
| author | David Rowley <drowley@postgresql.org> | 2025-11-30 12:55:34 +1300 |
|---|---|---|
| committer | David Rowley <drowley@postgresql.org> | 2025-11-30 12:55:34 +1300 |
| commit | 5424f4da9031ac4681ab002d20f021232070c96a (patch) | |
| tree | 4362d45b147d4bf1b9cf878a88346f46454f9837 /src/backend/optimizer/util/clauses.c | |
| parent | c902bd57af998b52bde98c87916190309639129e (diff) | |
Don't call simplify_aggref with a NULL PlannerInfoHEADorigin/masterorigin/HEADmaster
42473b3b3 added prosupport infrastructure to allow simplification of
Aggrefs during constant-folding. In some cases the context->root that's
given to eval_const_expressions_mutator() can be NULL. 42473b3b3 failed
to take that into account, which could result in a crash.
To fix, add a check and only call simplify_aggref() when the PlannerInfo
is set.
Author: David Rowley <dgrowleyml@gmail.com>
Reported-by: Birler, Altan <altan.birler@tum.de>
Discussion: https://postgr.es/m/132d4da23b844d5ab9e352d34096eab5@tum.de
Diffstat (limited to 'src/backend/optimizer/util/clauses.c')
| -rw-r--r-- | src/backend/optimizer/util/clauses.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index 9975185934b..bda4c4eb292 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -2638,7 +2638,9 @@ eval_const_expressions_mutator(Node *node, } case T_Aggref: node = ece_generic_processing(node); - return simplify_aggref((Aggref *) node, context); + if (context->root != NULL) + return simplify_aggref((Aggref *) node, context); + return node; case T_OpExpr: { OpExpr *expr = (OpExpr *) node; |
