Re: INTEGER range ("-2147483648" is not accepted.) - Mailing list pgsql-docs

From Thom Brown
Subject Re: INTEGER range ("-2147483648" is not accepted.)
Date
Msg-id AANLkTil8g4KBzILetkAnygNnltFKothMXfITfOH9FraR@mail.gmail.com
Whole thread Raw
In response to INTEGER range ("-2147483648" is not accepted.)  (Satoshi Nagayasu <satoshi.nagayasu@gmail.com>)
Responses Re: INTEGER range ("-2147483648" is not accepted.)  (Thom Brown <thombrown@gmail.com>)
List pgsql-docs
On 22 June 2010 09:59, Satoshi Nagayasu <satoshi.nagayasu@gmail.com> wrote:
> Magnus,
>
> Thanks for your advice. I've understood how it happens.
>
> However, it looks tricky and difficult to understand,
> so I hope that the message could be more understandable
> as Thom mentioned.
>
> Regards,
>

This does appear to be a gotcha, as the following returns a negative
integer as expected:

postgres=# SELECT -2147483648;
  ?column?
-------------
 -2147483648
(1 row)

postgres=# SELECT pg_typeof(-2147483648);
 pg_typeof
-----------
 integer
(1 row)

And just in case...

postgres=# SELECT pg_typeof(test.my_num) FROM (SELECT -2147483648) AS
test(my_num);
 pg_typeof
-----------
 integer
(1 row)

So it's affected by the cast operator?

Thom

pgsql-docs by date:

Previous
From: Thom Brown
Date:
Subject: Re: INTEGER range ("-2147483648" is not accepted.)
Next
From: Thom Brown
Date:
Subject: Re: INTEGER range ("-2147483648" is not accepted.)