Re: BUG #15458: pg_typeof inconsistency on negative integer constant limits

From: Andres Freund <andres(at)anarazel(dot)de>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: elprans(at)gmail(dot)com, PostgreSQL Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15458: pg_typeof inconsistency on negative integer constant limits
Date: 2018-10-26 06:24:30
Message-ID: 20181026062430.653yvpzjweuketkb@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-10-26 08:17:38 Re: BUG #15458: pg_typeof inconsistency on negative integer constant limits
Previous Message Fabien COELHO 2018-10-26 06:02:59 Re: BUG #15458: pg_typeof inconsistency on negative integer constant limits