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

From Richard Guo
Subject Re: Eager aggregation, take 3
Date
Msg-id CAMbWs48A53PY1Y4zoj7YhxPww9fO1hfnbdntKfA855zpXfVFRA@mail.gmail.com
Whole thread Raw
In response to Re: Eager aggregation, take 3  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Eager aggregation, take 3
List pgsql-hackers
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.)

- Richard

Attachment

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: pg_restore documentation and --create/--single-transaction limitation
Next
From: Chao Li
Date:
Subject: Re: Adjust error message for CREATE STATISTICS to account for expressions