Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id DA21A687810 for ; Tue, 22 Jun 2010 10:37:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 22860-05-5 for ; Tue, 22 Jun 2010 13:37:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f174.google.com (mail-px0-f174.google.com [209.85.212.174]) by mail.postgresql.org (Postfix) with ESMTP id 348A568797B for ; Tue, 22 Jun 2010 10:37:46 -0300 (ADT) Received: by pxi12 with SMTP id 12so1987967pxi.19 for ; Tue, 22 Jun 2010 06:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=WL+m3tnEMFo8bJ2/ry/3gE3TH0X3WKiSara8TGJiDYQ=; b=WSrNGBfqQQZkF5+UCVAl+loUf5vM3CHmHKRFlNgD5I6XStGMEcIJFiJe5tcny5MZ4P rJF1fYvrdou/QBVKBWHghrRCFfq6c5z+GTJn2W29FIUpAKGmMS6PbhM6TdnbFOysfrNd ZN75tj6OOR4GrkOLgsyETk7SNjZW1MWLz88yc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=XkWqMN3Fz2FNNPQ0c8vVQq+gyhH77OBWYu4GZQe8dfIAIjzwoRqlsNTu0SxhjPgaax 55dALhFFRgYDR/JTJ7Q4bBHL6odOWX3QmsCQNUgY4r6+YXRk1lZl2IsUiBPbqUWi20pm /DYSDkOGNClHYxSx8D9+lDvJuKr5A3W0kKZsM= Received: by 10.143.154.19 with SMTP id g19mr3234672wfo.301.1277213864122; Tue, 22 Jun 2010 06:37:44 -0700 (PDT) Received: from [10.0.2.101] (p0245ed.tokyff01.ap.so-net.ne.jp [121.2.69.237]) by mx.google.com with ESMTPS id b12sm1259760rvn.10.2010.06.22.06.37.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 22 Jun 2010 06:37:42 -0700 (PDT) Message-ID: <4C20BCA9.9050400@gmail.com> Date: Tue, 22 Jun 2010 22:37:45 +0900 From: Satoshi Nagayasu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: Thom Brown CC: Magnus Hagander , pgsql-docs Subject: Re: INTEGER range ("-2147483648" is not accepted.) References: <4C207403.3080103@gmail.com> <4C207B8B.4030104@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201006/50 X-Sequence-Number: 5618 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 wrote: >> On 22 June 2010 09:59, Satoshi Nagayasu 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