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

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integerout of range"
Дата
Msg-id CAKFQuwaF9wkNeZ=C1mnKwyC60m9_Z5bSAVQLjXui5=dkvFxAmg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integer out of range"  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [GENERAL] SELECT x'00000000F'::int leading zeros causes "integerout of range"  (John McKown <john.archie.mckown@gmail.com>)
Список pgsql-general
On Friday, February 24, 2017, Tom Lane <tgl@sss.pgh.pa.us> wrote:
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".


IME The error message itself is to blame here - we are checking for a malformed (too many characters) integer varbit representation but then reporting that the we somehow got a valid integer but that it is "out of range".

David J.

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

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