Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m9UDe-0001Oz-6I for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Jul 2021 15:14:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m9UDd-0002nH-5V for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Jul 2021 15:14:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m9UDc-0002n9-V2 for pgsql-bugs@lists.postgresql.org; Fri, 30 Jul 2021 15:14:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m9UDb-00056K-2Z for pgsql-bugs@lists.postgresql.org; Fri, 30 Jul 2021 15:14:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 16UFEWDS1003603; Fri, 30 Jul 2021 11:14:32 -0400 From: Tom Lane To: John Naylor cc: kjs@teews.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17128: minimum numeric 'integer' is -2147483647 not -2147483648 as documented In-reply-to: References: <17128-55a8a879727a3e3a@postgresql.org> Comments: In-reply-to John Naylor message dated "Fri, 30 Jul 2021 11:05:14 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1003601.1627658072.1@sss.pgh.pa.us> Date: Fri, 30 Jul 2021 11:14:32 -0400 Message-ID: <1003602.1627658072@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk John Naylor writes: > On Fri, Jul 30, 2021 at 7:53 AM PG Bug reporting form < > noreply@postgresql.org> wrote: >> - if (l < -INT_MAX || l > INT_MAX) >> + if (l < (-INT_MAX - 1) || l > INT_MAX) > Yeah, that looks like it should be INT_MIN instead. I'll see about making > that happen. Thanks for the report! The whole stanza perhaps ought to be within #if SIZEOF_LONG > SIZEOF_INT otherwise some compilers will bleat about useless tests. (I looked at PGTYPESnumeric_to_long and it seems like it will do the right thing for 32-bit long, assuming strtol does.) regards, tom lane