WIDTH_BUCKET inconsistency - Mailing list pgsql-bugs

From Martin Visser
Subject WIDTH_BUCKET inconsistency
Date
Msg-id 6FA5117D-6AED-4656-8FEF-B74AC18FAD85@brytlyt.com
Whole thread Raw
Responses Re: WIDTH_BUCKET inconsistency  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Inconsistent results between numeric and double precision types.

Reproduction:
CREATE TABLE tab( 
    col1 REAL,
    col2 DOUBLE PRECISION,
    col3 NUMERIC
);

INSERT into tab VALUES 
    (10, 10, 10), 
    (20, 20, 20), 
    (30, 30, 30), 
    (40, 40, 40), 
    (50, 50, 50), 
    (60, 60, 60), 
    (70, 70, 70), 
    (80, 80, 80), 
    (90, 90, 90), 
    (100, 100, 100);

SELECT col1, width_bucket(col1, 10, 100, 9), width_bucket(col2, 10, 100, 9), width_bucket(col3, 10, 100, 9) FROM tab;

 col1 | width_bucket | width_bucket | width_bucket
------+--------------+--------------+--------------
   10 |            1 |            1 |            1
   20 |            2 |            2 |            1
   30 |            3 |            3 |            2
   40 |            4 |            4 |            3
   50 |            5 |            5 |            4
   60 |            6 |            6 |            6
   70 |            7 |            7 |            7
   80 |            8 |            8 |            8
   90 |            9 |            9 |            9
  100 |           10 |           10 |           10
(10 rows)

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #16659: postgresql leaks memory or do not limit its usage
Next
From: PG Bug reporting form
Date:
Subject: BUG #16661: Changing columns after the rule is created leads to an error when the RETURNING is used