https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-INFINITE has:
Also, some element types have a notion of “infinity”, but that is just
another value so far as the range type mechanisms are concerned.
For example, in timestamp ranges, [today,] means the same thing as [today,).
But [today,infinity] means something different from [today,infinity) —
the latter excludes the special timestamp value infinity.
This does not work as expected for ranges with discrete base types,
notably daterange:
test=> SELECT '[2000-01-01,infinity]'::daterange;
daterange
-----------------------
[2000-01-01,infinity)
(1 row)
test=> SELECT '(-infinity,2000-01-01)'::daterange;
daterange
------------------------
[-infinity,2000-01-01)
(1 row)
This is because "daterange_canonical" makes no difference for 'infinity',
and adding one to infinity does not change the value.
I propose the attached patch which fixes the problem.
Yours,
Laurenz Albe