Re: Why does the range type's upper function behave inconsistently?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why does the range type's upper function behave inconsistently?
Дата
Msg-id 10004.1436117287@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Why does the range type's upper function behave inconsistently?  (Dane Foster <studdugie@gmail.com>)
Список pgsql-general
Dane Foster <studdugie@gmail.com> writes:
> I don't understand the inconsistent behavior of the range types' upper
> function in regard to inclusive ranges.

The behavior is different for discrete vs. continuous ranges.  For
example,

regression=# select int4range(1, 4, '[]');
 int4range
-----------
 [1,5)
(1 row)

regression=# select numrange(1, 4, '[]');
 numrange
----------
 [1,4]
(1 row)

In the discrete case we normalize the bounds to '[)' style so that ranges
that contain the same sets of values will compare as equal even when they
were written differently.  But there's no practical way to do that for
continuous types.  See
http://www.postgresql.org/docs/9.4/static/rangetypes.html#RANGETYPES-DISCRETE

            regards, tom lane


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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: Why does the range type's upper function behave inconsistently?
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Why does the range type's upper function behave inconsistently?