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