Bad canonicalization for dateranges with 'infinity' bounds

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Bad canonicalization for dateranges with 'infinity' bounds
Дата
Msg-id 77f24ea19ab802bc9bc60ddbb8977ee2d646aec1.camel@cybertec.at
обсуждение исходный текст
Ответы Re: Bad canonicalization for dateranges with 'infinity' bounds  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-hackers
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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: walsender vs. XLogBackgroundFlush during shutdown
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Bad canonicalization for dateranges with 'infinity' bounds