Re: Why does the range type's upper function behave inconsistently? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why does the range type's upper function behave inconsistently?
Date
Msg-id 10004.1436117287@sss.pgh.pa.us
Whole thread Raw
In response to Why does the range type's upper function behave inconsistently?  (Dane Foster <studdugie@gmail.com>)
List 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 by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Why does the range type's upper function behave inconsistently?
Next
From: Adrian Klaver
Date:
Subject: Re: Why does the range type's upper function behave inconsistently?