Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integer out of range"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integer out of range"
Дата
Msg-id 9486.1487963586@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [GENERAL] SELECT x'00000000F'::int leading zeros causes "integer out of range"  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integerout of range"  (Melvin Davidson <melvin6925@gmail.com>)
Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integerout of range"  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Justin Pryzby <pryzby@telsasoft.com> writes:
> Is this expected behavior ?
>     ts=# SELECT x'00000000F'::int;
>     ERROR:  22003: integer out of range
>     LOCATION:  bittoint4, varbit.c:1575

Yes.  The provided operation is "convert a bitstring of up to 32 bits
to an integer".  It's not "guess whether it's okay to throw away some
bits to make an integer".

As an example, even if you think it's obvious that it would be okay
to convert that bitstring to "15", would it be all right to convert
x'FFFFFFFFF' to "-1" ?

            regards, tom lane


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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integer out of range"
Следующее
От: Melvin Davidson
Дата:
Сообщение: Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integerout of range"