Skip site navigation (1) Skip section navigation (2)

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

From: Satoshi Nagayasu <satoshi(dot)nagayasu(at)gmail(dot)com>
To: Thom Brown <thombrown(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 13:37:45
Message-ID: 4C20BCA9.9050400@gmail.com (view raw or flat)
Thread:
Lists: pgsql-docs
Thom,

> Actually, come to think of it, shouldn't we have a gotchas page on the wiki?

I agree with that it should be described in some tech document,
but I don't have any good idea where/how it should be written.

Basically, it's a parser issue, but app developers may meet it
on their type casting (my guess), and it's a bit tricky.

Regards,

On 2010/06/22 18:57, Thom Brown wrote:
> On 22 June 2010 10:46, Thom Brown<thombrown(at)gmail(dot)com>  wrote:
>> 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
>>
>
> Actually, come to think of it, shouldn't we have a gotchas page on the wiki?
>
> Thom
>


-- 
NAGAYASU Satoshi <satoshi(dot)nagayasu(at)gmail(dot)com>

In response to

pgsql-docs by date

Next:From: Bruce MomjianDate: 2010-06-22 16:20:15
Subject: pg_ctl server log differenes on win32
Previous:From: Joshua TolleyDate: 2010-06-22 12:56:11
Subject: Re: hot standby documentation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group