From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Repair breakage of aggregate FILTER option. |
Date: | 2017-10-16 19:24:49 |
Message-ID: | E1e4B0L-0002yo-TT@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Repair breakage of aggregate FILTER option.
An aggregate's input expression(s) are not supposed to be evaluated
at all for a row where its FILTER test fails ... but commit 8ed3f11bb
overlooked that requirement. Reshuffle so that aggregates having a
filter clause evaluate their arguments separately from those without.
This still gets the benefit of doing only one ExecProject in the
common case of multiple Aggrefs, none of which have filters.
While at it, arrange for filter clauses to be included in the common
ExecProject evaluation, thus perhaps buying a little bit even when
there are filters.
Back-patch to v10 where the bug was introduced.
Discussion: https://postgr.es/m/30065.1508161354@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/c3dfe0fec01469b8a7de327303cad50ba8ed338a
Modified Files
--------------
src/backend/executor/nodeAgg.c | 186 ++++++++++++++++++++-----------
src/include/nodes/execnodes.h | 6 +-
src/test/regress/expected/aggregates.out | 6 +
src/test/regress/sql/aggregates.sql | 2 +
4 files changed, 130 insertions(+), 70 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-10-16 19:51:28 | pgsql: Allow the built-in ordered-set aggregates to share transition st |
Previous Message | Alvaro Herrera | 2017-10-16 10:24:09 | pgsql: Rework DefineIndex relkind check |