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

Поиск
Список
Период
Сортировка
От Mats Kindahl
Тема Re: BUG #17876: Function width_bucket() for float8 input returns value out of range
Дата
Msg-id CA+14424DZUcLpWnoRURmT1m6Uet1_R39sV=8XhtFRiigVtYqDg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #17876: Function width_bucket() for float8 input returns value out of range  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #17876: Function width_bucket() for float8 input returns value out of range  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs

On Wed, Mar 29, 2023 at 2:33 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
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.)

Yes, I was wondering the same which is why I was adding these tests as a separate file to see if I could force a bad bucket.  It seems to be hard to construct a case where the underflow would cause a change in the result.

However, better safe than sorry, so I modified the patch to include the check. And yes, you're right in that there is no need to check for the operand diff since the previous checks guarantee that the operand is between the bounds, and since the diff between the bounds is not infinite, the diff between the operand and any of the bounds cannot be infinite. Added a comment to that effect to the patch as well.

Best wishes,
Mats Kindahl, Timescale


                        regards, tom lane
Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Richard Guo
Дата:
Сообщение: Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #17877: Referencing a system column in a foreign key leads to incorrect memory access