agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix volatile function evaluation in eager aggregation
Date: Mon, 06 Apr 2026 02:55:35 +0000
Message-ID: <E1w9a7i-003Aa4-1i@gemulon.postgresql.org> (raw)
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@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.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(+)
Message-ID: <E1w9a7i-003Aa4-1i@gemulon.postgresql.org>
Permalink: ../E1w9a7i-003Aa4-1i@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1w9a7i-003Aa4-1i@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix volatile function evaluation in eager aggregation
In-Reply-To: <E1w9a7i-003Aa4-1i@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox