Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dane Foster <studdugie@xxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux