Re: BUG #19722: Window PARTITION BY numeric treats equal values with different scales as separate partitions - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #19722: Window PARTITION BY numeric treats equal values with different scales as separate partitions
Date
Msg-id 2160451.1790433575@sss.pgh.pa.us
Whole thread
In response to BUG #19722: Window PARTITION BY numeric treats equal values with different scales as separate partitions  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

Previous
From: Nate Clark
Date:
Subject: Re: BUG #19720: pg_trgm GiST index corruption from gtrgm_union() dropping SIGNKEY
Next
From: Rahul Yadav
Date:
Subject: Re: BUG #19670: Silent Integer Overflow in time_pl_interval() Returns Wrong Time Value