Re: Wrong results with grouping sets - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Wrong results with grouping sets
Date
Msg-id CAMbWs49Yj3hz4uBA3hsCYHth0uEzfYbXJB+ONvQMJr+TapnFEA@mail.gmail.com
Whole thread Raw
In response to Re: Wrong results with grouping sets  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Wrong results with grouping sets
List pgsql-hackers
On Tue, Aug 6, 2024 at 4:17 PM Richard Guo <guofenglinux@gmail.com> wrote:
> I fixed this issue in v13 by performing the replacement of GROUP Vars
> after we've done with expression preprocessing on targetlist and
> havingQual.  An ensuing effect of this approach is that a HAVING
> clause may contain expressions that are not fully preprocessed if they
> are part of grouping items.  This is not an issue as long as the
> clause remains in HAVING.  But if the clause is moved or copied into
> WHERE, we need to re-preprocess these expressions.  Please see the
> attached for the changes.

I'm seeking the possibility to push 0001 and 0002 sometime this month.
Please let me know if anyone thinks this is unreasonable.

For 0003, it might be extended to remove all no-op PHVs except those
that are serving to isolate subexpressions, not only the PHVs used to
carry the nullingrel bit that represents the grouping step.  There is
a separate thread for it [1].

[1] https://postgr.es/m/CAMbWs48biJp-vof82PNP_LzzFkURh0W+RKt4phoML-MyYavgdg@mail.gmail.com

Thanks
Richard



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Improving the latch handling between logical replication launcher and worker processes.