From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Greg Stark <stark@mit.edu>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: binoternary@gmail.com, pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14986: -2147483648 is minimum value of integer but -2147483648::integer fails (out of range).
Date: Thu, 21 Dec 2017 11:27:09 -0300
Message-ID: <20171221142709.3uddkvcrxtlb6mhy@alvherre.pgsql> (raw)
In-Reply-To: <CAM-w4HNudmE0OReuV7YCAkO2=0rgxNGC_43G-R8oKXRnJTUNKw@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: alvherre@alvh.no-ip.org, stark@mit.edu, magnus@hagander.net
Subject: Re: BUG #14986: -2147483648 is minimum value of integer but -2147483648::integer fails (out of range).
In-Reply-To: <20171221142709.3uddkvcrxtlb6mhy@alvherre.pgsql>
References: <CAM-w4HNudmE0OReuV7YCAkO2=0rgxNGC_43G-R8oKXRnJTUNKw@mail.gmail.com> <20171221142709.3uddkvcrxtlb6mhy@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox