Hi,
On 2018-10-26 08:02:59 +0200, Fabien COELHO wrote:
>
> > > SELECT -2147483648::integer;
> > > ERROR: integer out of range
> >
> > It's just a precedence issue. :: binds with higher precedence, so the
> > above is actually -(2147483648::integer), rather than
> > (-2147483648)::integer. Therefore you get an overflow.
>
> The error message may be nicer by expliciting the offending string, and/or
> locating it precisely within the query?
Including the string would make the function not leak proof though, so
that seems like a no-go. Location would be possible, but there's some
architectural issues around doing so at execution time - we only really
have the setup to do so at parse time currently. Tom was looking to
change that at some point however, iirc.
Greetings,
Andres Freund