Re: BUG #19722: Window PARTITION BY numeric treats equal values with different scales as separate partitions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 1482694023(at)qq(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19722: Window PARTITION BY numeric treats equal values with different scales as separate partitions
Date: 2026-09-26 14:39:35
Message-ID: 2160451.1790433575@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:
> CREATE TEMP TABLE decimal_source (raw_value text NOT NULL);
> INSERT INTO decimal_source VALUES
> ('1.0'), ('1.00'), ('1.000');

> SELECT amount, partition_size
> FROM (
> SELECT raw_value::numeric AS amount,
> COUNT(*) OVER (PARTITION BY raw_value::numeric) AS partition_size
> FROM decimal_source
> ) AS windowed
> WHERE scale(amount) = 1;

This is a near-duplicate of many recent reports[1][2][3][4][5].
Not one of them has offered a reason why they think that testing
scale() of a grouped numeric column is a useful or even well-defined
thing to do. Do you have a real-world use case? What is it?

regards, tom lane

[1] https://www.postgresql.org/message-id/flat/CA%2BCOZaA0tnyza0pHx6-UEdM5dcLGP4RJJ0KOHFq%2BwVQCY2Jyiw%40mail.gmail.com
[2] https://www.postgresql.org/message-id/flat/19588-e32b82433b3660ea%40postgresql.org
[3] https://www.postgresql.org/message-id/flat/19619-fc646db1c6b2dc90%40postgresql.org
[4] https://www.postgresql.org/message-id/flat/19697-6e7ccba388bbe858%40postgresql.org
[5] https://www.postgresql.org/message-id/flat/19713-635b8656d07464df%40postgresql.org

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Rahul Yadav 2026-09-26 15:25:21 Re: BUG #19670: Silent Integer Overflow in time_pl_interval() Returns Wrong Time Value
Previous Message Nate Clark 2026-09-26 14:26:32 Re: BUG #19720: pg_trgm GiST index corruption from gtrgm_union() dropping SIGNKEY