Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id CB415632C0A for ; Tue, 22 Jun 2010 22:49:48 -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 74238-03 for ; Wed, 23 Jun 2010 01:49:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id BB41B6329BB for ; Tue, 22 Jun 2010 22:49:41 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o5N1nbRJ011646; Tue, 22 Jun 2010 21:49:37 -0400 (EDT) To: Thom Brown cc: David Fetter , Satoshi Nagayasu , pgsql-docs@postgresql.org Subject: Re: INTEGER range ("-2147483648" is not accepted.) In-reply-to: References: <4C207403.3080103@gmail.com> <20100622230754.GE15203@fetter.org> Comments: In-reply-to Thom Brown message dated "Wed, 23 Jun 2010 00:16:06 +0100" Date: Tue, 22 Jun 2010 21:49:37 -0400 Message-ID: <11645.1277257777@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/57 X-Sequence-Number: 5625 Thom Brown writes: > Is that the right behaviour though? Shouldn't the signed value reach > the cast step rather than the absolute value? Or maybe Postgres could > implicitly accept -12345::integer to be (-12345)::integer. Is there a > blocking reason as to why it must work this way? Yes. There is no reason to assume that - means the same thing for every datatype. In general, :: should (and does) bind tighter than *every* operator, to ensure that the appropriately typed operator is applied. regards, tom lane