| From: | Richard Guo <rguo(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix volatile function evaluation in eager aggregation |
| Date: | 2026-04-06 02:55:35 |
| Message-ID: | E1w9a7i-003Aa4-1i@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix volatile function evaluation in eager aggregation
Pushing aggregates containing volatile functions below a join can
violate volatility semantics by changing the number of times the
function is executed.
Here we check the Aggref nodes in the targetlist and havingQual for
volatile functions and disable eager aggregation when such functions
are present.
Author: Richard Guo <guofenglinux(at)gmail(dot)com>
Reviewed-by: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAMbWs48A53PY1Y4zoj7YhxPww9fO1hfnbdntKfA855zpXfVFRA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3a08a2a8b4fd36a9fa0da0253d1ca053c19047d5
Modified Files
--------------
src/backend/optimizer/plan/initsplan.c | 11 ++++++++
src/test/regress/expected/eager_aggregate.out | 38 +++++++++++++++++++++++++++
src/test/regress/sql/eager_aggregate.sql | 14 ++++++++++
3 files changed, 63 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-04-06 04:21:44 | pgsql: Simplify redundant current_database() subqueries in stats.sql re |
| Previous Message | Fujii Masao | 2026-04-06 02:36:15 | pgsql: Add wal_sender_shutdown_timeout GUC to limit shutdown wait for r |