Re: BUG #17876: Function width_bucket() for float8 input returns value out of range

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mats Kindahl <mats@timescale.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-03-29T12:33:37Z
Lists: pgsql-bugs
Mats Kindahl <mats@timescale.com> writes:
> Attached is a proposed fix for the issue.

Hm.  Aren't you replacing a risk of overflow with a risk of underflow?
I'd be happier about doing this only if isinf(bound2 - bound1), or
the reverse for the other path.  (Seems like we shouldn't need to
check the operand diff separately.)

			regards, tom lane



Commits

  1. Further tweaking of width_bucket() edge cases.

  2. Avoid overflow in width_bucket_float8().