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 1xIq5q-00000003vQc-2aMt for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2026 16:20:10 +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 1xIq5p-00000007wZq-2bSW for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2026 16:20:09 +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 1xIPYk-00000002v1w-3PmM for pgsql-bugs@lists.postgresql.org; Sun, 18 Oct 2026 12:00:15 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xIPYf-00000002nwz-2KvP for pgsql-bugs@lists.postgresql.org; Sun, 18 Oct 2026 12:00:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=M/x88A0+twFJdgmNcpIOc+Gf8XJ0SevAsEP89kjZJVI=; b=rI/CXhzEs8D7Rh7buDXWa5Y0bu M06HQGqxeO8bXo/MsblX7CBBKQoxWUDFTgPStO+blL/a494iEtjN4DSus8sdyYF/+kkLLVhLjJBkK t2xIaB7qkFT/poC5ctVCLohYPFI8295aTJpWpvRk+mqtih1C8vtW8ultlLIcxO8gwDyMkc0ijA1NQ KT4yDqtO1uRP6OifC6AALMuXgVIJHB4Bab4GSbzvHSplMYkMICC/BUsMEqM6PGlYWov8kV7QY6JGy kmG6rfmHyNe7UGC5dRAA7iQClG4r8oks/P8mPqcMRUyKKV3wYt7/TF4/z7dOpjChWKL8MWWLJBvgf x8Pf45xA==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xIPYb-00000007feX-30CJ for pgsql-bugs@lists.postgresql.org; Sun, 18 Oct 2026 12:00:07 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xIPYa-00000005fPF-2TCz for pgsql-bugs@lists.postgresql.org; Sun, 18 Oct 2026 12:00:04 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19769: int8range() raises an error for an inclusive upper bound at BIGINT_MAX To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: 1243111560@qq.com Reply-To: 1243111560@qq.com, pgsql-bugs@lists.postgresql.org Date: Sun, 18 Oct 2026 11:59:47 +0000 Message-ID: <19769-36a284b9d245c7bf@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19769 Logged by: Zhs Email address: 1243111560@qq.com PostgreSQL version: 14.24 Operating system: Windows x64 Description: =20 Reproduced on PostgreSQL 14.24 and PostgreSQL 14.20 on Windows x64. 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). An equivalent representation over the bigint domain can be constructed with an unbounded upper bound: [9223372036854775807,). This control range contains BIGINT_MAX and does not contain BIGINT_MAX - 1. 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. How to repeat SELECT version(); -- This raises an error: SELECT int8range( '9223372036854775807'::bigint, '9223372036854775807'::bigint, '[]' ); -- Control: this succeeds and represents the same set over bigint values. SELECT int8range('9223372036854775807'::bigint, NULL, '[)') AS control_range, int8range('9223372036854775807'::bigint, NULL, '[)') @> '9223372036854775807'::bigint AS contains_max, int8range('9223372036854775807'::bigint, NULL, '[)') @> '9223372036854775806'::bigint AS contains_max_minus_one; Actual result The first int8range() call fails with: ERROR: bigint out of range SQLSTATE: 22003 The control query succeeds and returns: control_range: [9223372036854775807,) contains_max: true contains_max_minus_one: false Expected result The first call should succeed and return a range equivalent to the singleton set {9223372036854775807}. The control range demonstrates an equivalent representation over the bigint domain.