Re: to_hex() for negative inputs
От | Dean Rasheed |
---|---|
Тема | Re: to_hex() for negative inputs |
Дата | |
Msg-id | CAEZATCV7Gi08adZamHcL5Uy2MPqwbGGsz6E5he-_NeeXw4nhPg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: to_hex() for negative inputs (Aleksander Alekseev <aleksander@timescale.com>) |
Ответы |
Re: to_hex() for negative inputs
|
Список | pgsql-hackers |
On Wed, 25 Jan 2023 at 10:57, Aleksander Alekseev <aleksander@timescale.com> wrote: > > > Of course there is. This is easy to code in C using unsigned ints, > > without resorting to abs() (yes, I'm aware that abs() is undefined for > > INT_MIN). > > So in your opinion what is the expected result of to_hex(INT_MIN, > with_sign => true)? > "-80000000" or "-0x80000000", depending on whether the prefix is requested. The latter is legal input for an integer, which is the point (to allow round-tripping): SELECT int '-0x80000000'; int4 ------------- -2147483648 (1 row) SELECT pg_typeof(-0x80000000); pg_typeof ----------- integer (1 row) Regards, Dean
В списке pgsql-hackers по дате отправления: