On Nov19, 2011, at 21:57 , Tom Lane wrote:
> One thing I've been thinking for a bit is that for discrete ranges,
> I find the '[)' canonical form to be surprising/confusing. If we
> were to fix range_adjacent along the lines suggested by Florian,
> would it be practical to go over to '[]' as the canonical form?
> One good thing about that approach is that canonicalization wouldn't
> have to involve generating values that might overflow.
I have argued against that in the past, mostly because
1) It's better to be consistent
2) While it seems intuitive for integer ranges to use [] and float
ranges to use [), things are far less clear once you take other base
types into account. For example, we'd end up making ranges over DATE
use canonicalize to [], but ranges over TIMESTAMP to [). Which, at least
IMHO, is quite far from intuitive. And if we start "fixing" these issues
by making exception from the "discrete -> [], continuous -> [)" rule,
we'll end up with essentially arbitrary behaviour pretty quickly. At
which point (1) kicks it ;-)
And then there also ranges over NUMERIC, which can be both discrete
and continuous, depending on the typmod. Which I think is a good reason
in itself to make as little behaviour as possible depend on the continuity
or non-continuity of range types.
best regards,
Florian Pflug