Re: BUG #19713: WindowAgg qual pushdown gives wrong partition count when scale(numeric) distinguishes equal values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: imchifan(at)163(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19713: WindowAgg qual pushdown gives wrong partition count when scale(numeric) distinguishes equal values
Date: 2026-09-22 16:28:44
Message-ID: 1187008.1790094524@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> An outer scale(numeric) predicate is pushed below WindowAgg even though
> numeric values 1.0 and 1.00 are equal under PARTITION BY semantics while
> scale() distinguishes them.

Isn't this a duplicate of your own bug #19697, as well as bug #19619?

What's missing from all of these reports is a reason why scale()
would be sane to apply to an aggregated column. Such a query seems
inherently misguided to me, precisely because it is interrogating a
value that isn't guaranteed consistent across an aggregation group.
Is there a real-world use case here, and if so what is it?

regards, tom lane

[1] https://www.postgresql.org/message-id/19697-6e7ccba388bbe858@postgresql.org
[2] https://www.postgresql.org/message-id/19619-fc646db1c6b2dc90@postgresql.org

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-09-22 16:52:43 Re: BUG #19649: Qual pushdown into GROUP BY subqueries ignores non-equivalence-preserving references to grouping col
Previous Message Tom Lane 2026-09-22 16:19:43 Re: BUG #19712: MultiXact Recovery Deadlock