| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Don't use MinMaxAggPath if aggregate's input and output types do |
| Date: | 2026-11-09 14:21:53 |
| Message-ID: | E1xQQFt-000000003Qw-0LJ5@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Don't use MinMaxAggPath if aggregate's input and output types don't match.
A sort-operator option only makes sense for an aggregate that behaves
like MIN or MAX. We can't really verify whether an aggregate does,
but for our purposes the most important expectation is that the
aggregate returns the same type as its input. Without this, the
planner's conversion to a MinMaxAggPath plan risks type violations.
Since such aggregate definitions might already exist in the wild,
check this during planning and don't generate MinMaxAggPath if the
types don't match.
Reported-by: Zheng Yu <zheng(at)depthfirst(dot)com>
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Backpatch-through: 14-19
Security: CVE-2026-116331
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/75c0441bad98dda75b18cb2b7cf3d8c41e7bc631
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Modified Files
--------------
src/backend/optimizer/plan/planagg.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-11-09 14:21:54 | pgsql: Fix use-after-free in pg_show_all_settings(). |
| Previous Message | Noah Misch | 2026-11-09 14:21:52 | pgsql: Avoid use-after-free hazards in re-entrant use of pltcl. |