Re: avoid negating LONG_MIN in cash_out()

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: avoid negating LONG_MIN in cash_out()
Дата
Msg-id CAApHDvq0Gn0Ey3qv9S39KEZCgueOt=zBhs7LSL2Vf0wcfNA5mg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: avoid negating LONG_MIN in cash_out()  (Zhihong Yu <zyu@yugabyte.com>)
Ответы Re: avoid negating LONG_MIN in cash_out()  (Zhihong Yu <zyu@yugabyte.com>)
Список pgsql-hackers
On Fri, 12 Aug 2022 at 05:58, Zhihong Yu <zyu@yugabyte.com> wrote:
> Here is sample output with patch:
>
> # SELECT '-92233720368547758.085'::money;
> ERROR:  value "-92233720368547758.085" is out of range for type money
> LINE 1: SELECT '-92233720368547758.085'::money;

I'm struggling to follow along here. There are already overflow checks
for this in cash_in(), which is exactly where they should be.

The above case already fails on master, there's even a regression test
to make sure it does for this exact case, just look at money.out:356.
So, if we're already stopping this from happening in cash_in(), why do
you think it also needs to happen in cash_out()?

I'm also not sure why you opted to use LONG_MIN for your check. The C
type "Cash" is based on int64, that's not long.

David



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: tests and meson - test names and file locations
Следующее
От: Andres Freund
Дата:
Сообщение: test failure with gcc-12 -O3 -march=native