Re: Eager aggregation, take 3 - Mailing list pgsql-hackers

From Matheus Alcantara
Subject Re: Eager aggregation, take 3
Date
Msg-id DHINW6P0RE8W.1SJINOU6VRWV@gmail.com
Whole thread Raw
In response to Re: Eager aggregation, take 3  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-hackers
On Mon Mar 30, 2026 at 12:17 AM -03, Richard Guo wrote:
> On Thu, Oct 9, 2025 at 5:07 PM Richard Guo <guofenglinux@gmail.com> wrote:
>> I noticed an unnecessary header include in initsplan.c.  Will fix that
>> as well.
>
> I noticed a couple of issues that can lead to unexpected results.
> I've attached two patches to fix them.
>
> 1. Eager aggregation was incorrectly checking the data type's default
> collation rather than the expression's actual collation.  This allowed
> columns with non-deterministic collations to be pushed down, resulting
> in incorrect grouping.  Fixed by 0001.
>
> 2. Pushing aggregates containing volatile functions below a join
> alters their execution count.  Fixed by 0002.
>
> (As briefly discussed on Discord, this non-deterministic collation
> issue also exists in our long-existing logic for pushing HAVING down
> to WHERE.  But let's fix it for the eager aggregation first.)
>

Hi Richard,

The patches looks good to me and are working as expected. It seems very
straightforward, so I don't have any major comments.

I'm attaching some new tests that I've added to collate.icu.utf8 and
eager_aggregate regression tests during my review, fell free to include
any of them if it could be helpful or none.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Shared hash table allocations
Next
From: Andrew Dunstan
Date:
Subject: Re: meson: Make test output much more useful on failure (both in CI and locally)