public inbox for [email protected]  
help / color / mirror / Atom feed
From: Thom Brown <[email protected]>
To: Satoshi Nagayasu <[email protected]>
Cc: Magnus Hagander <[email protected]>
Cc: pgsql-docs <[email protected]>
Subject: Re: INTEGER range ("-2147483648" is not accepted.)
Date: Tue, 22 Jun 2010 10:57:34 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On 22 June 2010 10:46, Thom Brown <[email protected]> wrote:
> On 22 June 2010 09:59, Satoshi Nagayasu <[email protected]> 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



view thread (14+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: INTEGER range ("-2147483648" is not accepted.)
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox