Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xIqTJ-00000003vhe-3aJG for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2026 16:44:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xIqTI-000000087q9-1iwJ for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2026 16:44:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xIqTI-000000087q1-0guH for pgsql-bugs@lists.postgresql.org; Mon, 19 Oct 2026 16:44:24 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xIqTF-000000030qM-2GD6 for pgsql-bugs@lists.postgresql.org; Mon, 19 Oct 2026 16:44:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 69JGiDQs447162; Mon, 19 Oct 2026 12:44:13 -0400 From: Tom Lane To: 1243111560@qq.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19769: int8range() raises an error for an inclusive upper bound at BIGINT_MAX In-reply-to: <19769-36a284b9d245c7bf@postgresql.org> References: <19769-36a284b9d245c7bf@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Sun, 18 Oct 2026 11:59:47 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <447160.1792428253.1@sss.pgh.pa.us> Date: Mon, 19 Oct 2026 12:44:13 -0400 Message-ID: <447161.1792428253@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > The following call fails, even though both bounds are valid bigint values > and the requested range represents the singleton set containing the maximum > bigint value (9223372036854775807). The same thing happens with int4range: regression=# select '[2147483647,2147483647]'::int4range; ERROR: integer out of range and with other range types. > The PostgreSQL range documentation describes int8range as a discrete range > type whose canonical form is lower-inclusive and upper-exclusive ([)). Based > on this behavior, I expected the singleton range to be accepted and > represented equivalently rather than raising an out-of-range error. I think your expectation is mistaken. The documentation is quite clear that we normalize [x,y] to [x,y+1). regards, tom lane