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 1oOPCg-00014f-3p for pgsql-docs@arkaria.postgresql.org; Wed, 17 Aug 2022 19:59:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOPCe-0001Jt-ME for pgsql-docs@arkaria.postgresql.org; Wed, 17 Aug 2022 19:59:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOPCe-0001Jk-EH for pgsql-docs@lists.postgresql.org; Wed, 17 Aug 2022 19:59:48 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOPCW-000108-D3; Wed, 17 Aug 2022 19:59:48 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1oOPCT-001dYE-4k; Wed, 17 Aug 2022 15:59:37 -0400 Date: Wed, 17 Aug 2022 15:59:37 -0400 From: Bruce Momjian To: Kevin Sweet Cc: Alvaro Herrera , pgsql-docs@lists.postgresql.org, Michael Meskes Subject: Re: documentation describing the range of a number type 'integer' is incorrect Message-ID: References: <202110221343.rgmrpm6sy3be@alvherre.pgsql> <41540ed2-5ef9-8b46-6706-9baeb58b8851@teews.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41540ed2-5ef9-8b46-6706-9baeb58b8851@teews.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Oct 22, 2021 at 11:55:33AM -0700, Kevin Sweet wrote: > The bugs team agreed that it's a bug. The documentation accurately represents > the buggy code. I thought you might want to update the doc when the bug is > fixed. This was fixed in this commit: commit 5fcf3945bd Author: John Naylor Date: Fri Jul 30 13:50:23 2021 -0400 Fix range check in ECPG numeric to int conversion The previous coding guarded against -INT_MAX instead of INT_MIN, leading to -2147483648 being rejected as out of range. Per bug #17128 from Kevin Sweet Discussion: https://www.postgresql.org/message-id/flat/17128-55a8a879727a3e3a%40postgresql.org Reviewed-by: Tom Lane Backpatch to all supported branches This was backpatched to all branches, so any release after July 30, 2021 should have this fix. I don't see any docs that need adjusting. --------------------------------------------------------------------------- > > > On 10/22/21 6:43 AM, Alvaro Herrera wrote: > > On 2021-Jul-29, PG Doc comments form wrote: > > > https://www.postgresql.org/docs/13/datatype-numeric.html says that the range > of a numeric type integer is -2147483648 to +2147483647 but > PGTYPESnumeric_to_int considers -2147483648 (a perfectly valid 32-bit > integer) to be invalid because it compares to -INT_MAX instead of INT_MIN or > (-INT_MAX - 1). This goes back to the initial commit in the git repo for > src/interfaces/ecpg/pgtypeslib/numeric.c. And doc/src/sgml/ecpg.sgml > documents the min being -INT_MAX. > > This sounds like an ECPG bug, not a documentation problem. > > > -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson