Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 0F48B63523F for ; Tue, 22 Jun 2010 06:58:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73709-03 for ; Tue, 22 Jun 2010 09:57:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wy0-f174.google.com (mail-wy0-f174.google.com [74.125.82.174]) by mail.postgresql.org (Postfix) with ESMTP id 501E46351AA for ; Tue, 22 Jun 2010 06:57:56 -0300 (ADT) Received: by wyb33 with SMTP id 33so2978838wyb.19 for ; Tue, 22 Jun 2010 02:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=IQmJ/1RdgZXDOfvaTwNMo4w2eaTP/CO6B97XvVyj204=; b=PBn5Bfk+WFN0aOGmpYDY28ixxrDQHIXemfz6dsJpIZnJQooit6KuAvTFiwyBOR2QlW 67Bdiii372UnfuHKyfr4OdmLyJHeb9F62s5QAHyG8Wxzjfd968Sw7t/B0Fuezy6wV9ZF wULjRiCDC+sHX0lL1SoDFIkTi+EnCQ2w8eoXs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=DvpkjKhQXRCD0e104GjWxD3h5DZNtLFgJg1qLjJDsRy0077exmxiYoTElXn9qBoJum On4AFKjyb8g+JaIhaviI12ogfvVRghESrWZulFrS8tEGrcHveYVWG8RCGg+Mk6CuHiYe PYlG61Vpgphg2eUszTiqG5nt8efEqDiZwOtvw= Received: by 10.216.185.74 with SMTP id t52mr1116365wem.54.1277200674329; Tue, 22 Jun 2010 02:57:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.231.221 with HTTP; Tue, 22 Jun 2010 02:57:34 -0700 (PDT) In-Reply-To: References: <4C207403.3080103@gmail.com> <4C207B8B.4030104@gmail.com> From: Thom Brown Date: Tue, 22 Jun 2010 10:57:34 +0100 Message-ID: Subject: Re: INTEGER range ("-2147483648" is not accepted.) To: Satoshi Nagayasu Cc: Magnus Hagander , pgsql-docs Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/48 X-Sequence-Number: 5616 On 22 June 2010 10:46, Thom Brown wrote: > On 22 June 2010 09:59, Satoshi Nagayasu wrot= e: >> 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=3D# SELECT -2147483648; > =A0?column? > ------------- > =A0-2147483648 > (1 row) > > postgres=3D# SELECT pg_typeof(-2147483648); > =A0pg_typeof > ----------- > =A0integer > (1 row) > > And just in case... > > postgres=3D# SELECT pg_typeof(test.my_num) FROM (SELECT -2147483648) AS > test(my_num); > =A0pg_typeof > ----------- > =A0integer > (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