Why are exclusive lower bounds converted to inclusive?

479 Views Asked by At

Given the following code, is there a way to turn off Postgres converting the lower bound to inclusive, that is going from (date to [date+1?

CREATE TABLE test (range daterange NOT NULL );
INSERT INTO test (range) VALUES ('(2001-01-01,infinity)');
SELECT * FROM test -- returns [2001-01-02,infinity)
1

There are 1 best solutions below

0
Adrian Klaver On BEST ANSWER

The answer is in the docs Ranges:

The built-in range types int4range, int8range, and daterange all use a canonical form that includes the lower bound and excludes the upper bound; that is, [). User-defined range types can use other conventions, however.

So the answer is no.