Re: INTEGER range ("-2147483648" is not accepted.)

From: Thom Brown <thombrown(at)gmail(dot)com>
To: Satoshi Nagayasu <satoshi(dot)nagayasu(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: INTEGER range ("-2147483648" is not accepted.)
Date: 2010-06-22 09:46:30
Message-ID: AANLkTil8g4KBzILetkAnygNnltFKothMXfITfOH9FraR@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 22 June 2010 09:59, Satoshi Nagayasu <satoshi(dot)nagayasu(at)gmail(dot)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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Thom Brown 2010-06-22 09:57:34 Re: INTEGER range ("-2147483648" is not accepted.)
Previous Message Satoshi Nagayasu 2010-06-22 08:59:55 Re: INTEGER range ("-2147483648" is not accepted.)