Re: ERROR: int8 conversion to int4 is out of range - Mailing list pgsql-general

From Colin Campbell
Subject Re: ERROR: int8 conversion to int4 is out of range
Date
Msg-id Pine.BSF.4.33.0108301029440.25194-100000@guru.citec.qld.gov.au
Whole thread Raw
Responses Re: ERROR: int8 conversion to int4 is out of range
List pgsql-general
Hi,

Fixed it. (If anyone cares :-) Seems it might be a gcc optimizer
"feature".

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.

Colin


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: RFC: PostgreSQL and MySQL comparison.
Next
From: Tatsuo Ishii
Date:
Subject: Re: Default encoding in database