Re: Singleton range constructors versus functional coercion notation - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: Singleton range constructors versus functional coercion notation
Date
Msg-id 6CEF4721-9D8B-4BE8-80C1-34B6E45DC56E@phlo.org
Whole thread Raw
In response to Re: Singleton range constructors versus functional coercion notation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: range_adjacent and discrete ranges
Next
From: Peter Geoghegan
Date:
Subject: Re: Inlining comparators as a performance optimisation