Re: BUG #19769: int8range() raises an error for an inclusive upper bound at BIGINT_MAX

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 1243111560(at)qq(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19769: int8range() raises an error for an inclusive upper bound at BIGINT_MAX
Date: 2026-10-19 16:44:13
Message-ID: 447161.1792428253@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Narayanan Venkateswaran 2026-10-19 19:27:59 Re: BUG #19737: Empty `JSON_OBJECT` cannot use documented `ON NULL` or unique-key clauses
Previous Message shihao zhong 2026-10-19 16:10:38 Re: Inconsistency in psql output with \d+x PATTERN