Greg Stark wrote:
> The LOCATION line even gives a hint what's going on. 2147483648 was
> read as an int8 constant and the - operator returned an int8 and then
> the cast (being run during explain as part of preparing the plan)
> overflowed.
So this is because this is tokenized as four tokens -- minus, the
numeric value, :: and the identifier type name. This whole thing be
made simpler by turning the literal as one of the unknown type, with the
minus sign inside it. This ends up as two tokens:
select integer '-2147483648';
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services