pgsql: Don't call simplify_aggref with a NULL PlannerInfo

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't call simplify_aggref with a NULL PlannerInfo
Date: 2025-11-29 23:55:53
Message-ID: E1vPUnB-0022e0-01@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't call simplify_aggref with a NULL PlannerInfo

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(at)gmail(dot)com>
Reported-by: Birler, Altan <altan(dot)birler(at)tum(dot)de>
Discussion: https://postgr.es/m/132d4da23b844d5ab9e352d34096eab5@tum.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5424f4da9031ac4681ab002d20f021232070c96a

Modified Files
--------------
src/backend/optimizer/util/clauses.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2025-11-30 02:20:35 Re: pgsql: Inline pg_ascii_tolower() and pg_ascii_toupper().
Previous Message Peter Geoghegan 2025-11-29 21:43:19 pgsql: Update obsolete row compare preprocessing comments.