pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: elprans@gmail.com
Subject: BUG #15458: pg_typeof inconsistency on negative integer constant limits
Date: Wed, 24 Oct 2018 20:47:21 +0000
Message-ID: <15458-632e422e26e19786@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15458
Logged by:          Elvis Pranskevichus
Email address:      elprans@gmail.com
PostgreSQL version: 11.0
Operating system:   x86_64-pc-linux-gnu
Description:        

There seems to be an inconsistency in how the parser and the integer input
functions interpret the integers at the negative limit (-2 ^ 31 and -2 ^
63):


SELECT pg_typeof(-2147483648);

 pg_typeof
-----------
 integer
(1 row)

But:

SELECT -2147483648::integer;
ERROR:  integer out of range


The same issue applies to int8 as well.

PG_INT32_MIN is explicitly defined as -(2 ^ 31 - 1), and it seems 
inconsistent that the parser does not respect that when determining the 
type of numeric constants.



view thread (6+ messages)  latest in thread

Message-ID: <15458-632e422e26e19786@postgresql.org>
Permalink:  ../15458-632e422e26e19786@postgresql.org/
Also on:    postgresql.org/message-id/15458-632e422e26e19786@postgresql.org

 · 

reply

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: noreply@postgresql.org, elprans@gmail.com
  Subject: Re: BUG #15458: pg_typeof inconsistency on negative integer constant limits
  In-Reply-To: <15458-632e422e26e19786@postgresql.org>
  References: <15458-632e422e26e19786@postgresql.org>

* 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