WIDTH_BUCKET inconsistency

From: Martin Visser <Martin(dot)Visser(at)brytlyt(dot)com>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: WIDTH_BUCKET inconsistency
Date: 2020-10-08 10:57:27
Message-ID: 6FA5117D-6AED-4656-8FEF-B74AC18FAD85@brytlyt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-10-08 12:26:59 BUG #16661: Changing columns after the rule is created leads to an error when the RETURNING is used
Previous Message Emil Iggland 2020-10-07 19:13:29 Re: BUG #15858: could not stat file - over 4GB