I'm running PostgreSQL 9.4.5 and I've just got an unexpected result from this query:
2005-12-05 instead of
The following query excludes the upper bound by specifying
) instead of
upper() function supposed to return the upper bound limit of a given range? If so, by specifying
[2005-12-01,2005-12-04] as the range, it should return the upper bound which is
2005-12-04. It returns
2005-12-05 instead, which is very odd to me.
Any explanation on why this happens? I only know that
'[2005-12-01,2005-12-04]'::daterange is translated by PostgreSQL to
'[2005-12-01,2005-12-05)'::daterange, but this doesn't explain why
2005-12-05 should be the upper bound when I have explicitly specified
2005-12-04 as the upper bound.