Re: ERROR: int8 conversion to int4 is out of range

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ERROR: int8 conversion to int4 is out of range
Дата
Msg-id 24293.999571772@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ERROR: int8 conversion to int4 is out of range  (Colin Campbell <sgcccdc@citec.qld.gov.au>)
Список pgsql-general
Colin Campbell <sgcccdc@citec.qld.gov.au> writes:
> Fixed it. (If anyone cares :-) Seems it might be a gcc optimizer
> "feature".

Which gcc version, on just what platform, was that again?

> The code in backend/utils/adt/int8.c was:

>         if ((val < (int64)INT_MIN) || (val > (int64)INT_MAX))
>                 elog(ERROR, "int8 conversion to int4 is out of range");

> If I changed it to

>         if ((val < INT_MIN))
>                 elog(ERROR, "int8 conversion to int4 is out of range - too small");
>         if ((val > INT_MAX))
>                 elog(ERROR, "int8 conversion to int4 is out of range - too big");

> the error went away.

Hmm, there seem to be two changes here.  Is it the splitup of the OR
test, or the removal of the (int64) casts that does the trick?  Or
do you really need both changes?

I wouldn't mind applying the OR splitup to the master sources, but I'm
a little more paranoid about applying the cast removal.  Seems like that
might induce problems on other compilers.  So I'm hoping you only need
the OR splitup to make it work.

            regards, tom lane

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

Предыдущее
От: David Ford
Дата:
Сообщение: How to select using LIKE with bytea?
Следующее
От:
Дата:
Сообщение: How Does TEMP Table Work In Plpgsql?