pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix eager aggregation below volatile join clauses 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix eager aggregation below volatile join clauses @ 2026-10-29 06:34 Richard Guo <rguo@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Richard Guo @ 2026-10-29 06:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix eager aggregation below volatile join clauses Eager aggregation could push a partial aggregation down to a relation that is later joined using a join clause containing volatile functions. The clause is then evaluated once per group rather than once per input row, which changes the number of times the function is executed. To fix, refuse to build grouped paths for a relation if any of its join clauses contains volatile functions. Back-patch to v19, where eager aggregation was introduced. Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Manu <manuelreyesbravo@gmail.com> Discussion: https://postgr.es/m/CAGRkXqSc_qtpuPm34qoS1z0LVx4+Hc+JcJkbDEVC=z2ai4VQ1w@mail.gmail.com Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/27c844034f827b3910bc8a358780c6609ba87a41 Modified Files -------------- src/backend/optimizer/util/relnode.c | 13 +++++++++++++ src/test/regress/expected/eager_aggregate.out | 20 ++++++++++++++++++++ src/test/regress/sql/eager_aggregate.sql | 7 +++++++ 3 files changed, 40 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix eager aggregation below volatile join clauses @ 2026-10-29 06:34 Richard Guo <rguo@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Richard Guo @ 2026-10-29 06:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix eager aggregation below volatile join clauses Eager aggregation could push a partial aggregation down to a relation that is later joined using a join clause containing volatile functions. The clause is then evaluated once per group rather than once per input row, which changes the number of times the function is executed. To fix, refuse to build grouped paths for a relation if any of its join clauses contains volatile functions. Back-patch to v19, where eager aggregation was introduced. Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Manu <manuelreyesbravo@gmail.com> Discussion: https://postgr.es/m/CAGRkXqSc_qtpuPm34qoS1z0LVx4+Hc+JcJkbDEVC=z2ai4VQ1w@mail.gmail.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0c6e0437110dd6ceb14fdca5b323bc1b058a13cf Modified Files -------------- src/backend/optimizer/util/relnode.c | 13 +++++++++++++ src/test/regress/expected/eager_aggregate.out | 20 ++++++++++++++++++++ src/test/regress/sql/eager_aggregate.sql | 7 +++++++ 3 files changed, 40 insertions(+) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-10-29 06:34 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-10-29 06:34 pgsql: Fix eager aggregation below volatile join clauses Richard Guo <rguo@postgresql.org> 2026-10-29 06:34 pgsql: Fix eager aggregation below volatile join clauses Richard Guo <rguo@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox