Re: width_bucket issue

2018-07-24 Thread Christophe Pettus
> On Jul 24, 2018, at 13:02, Raphaël Berbain wrote: > I'd expect b1 = b2 = 2. What am I missing? The problem appears to be due to rounding during the intermediate calculations. In compute_bucket() in numeric.c: div_var(&operand_var, &bound1_var, result_var,

width_bucket issue

2018-07-24 Thread Raphaël Berbain
Hi, The width_bucket function doesn't seem to work the way I'd expect: postgres=# SELECT width_bucket(4, 0, 12, 3) b1, width_bucket(4 :: NUMERIC, 0, 12, 3) b2; b1 | b2 + 2 | 1 (1 row) I'd expect b1 = b2 = 2. What am I missing? This is with 10.4 running as a docker container, if it ma