pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
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
Date: Mon, 19 Oct 2026 12:44:13 -0400
Message-ID: <447161.1792428253@sss.pgh.pa.us> (raw)
In-Reply-To: <19769-36a284b9d245c7bf@postgresql.org>
References: <19769-36a284b9d245c7bf@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> 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






view thread (2+ messages)

Message-ID: <447161.1792428253@sss.pgh.pa.us>
Permalink:  ../447161.1792428253@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/447161.1792428253@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, 1243111560@qq.com
  Subject: Re: BUG #19769: int8range() raises an error for an inclusive upper bound at BIGINT_MAX
  In-Reply-To: <447161.1792428253@sss.pgh.pa.us>
  References: <19769-36a284b9d245c7bf@postgresql.org> <447161.1792428253@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox