Re: Range Types and extensions - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: Range Types and extensions
Date
Msg-id A98D8DC3-4368-4B87-A09C-43FB3F78A424@phlo.org
Whole thread Raw
In response to Re: Range Types and extensions  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: Range Types and extensions
List pgsql-hackers
On Jun20, 2011, at 19:16 , Merlin Moncure wrote:
> On Mon, Jun 20, 2011 at 11:21 AM, Jeff Davis <pgsql@j-davis.com> wrote:
> hm, what if there *was( only one range type per base type, but in the
> various contexts where specific ordering and collation was important
> you could optionally pass them in?  Meaning, the specific ordering was
> not bound rigidly to the type, but to the operation?

I suggested that previously here http://archives.postgresql.org/pgsql-hackers/2011-06/msg00846.php

In the ensuing discussion, however, it became clear that by doing so
range types become little more than a pair of values. More specifically,
a range then *doesn't* represent a set of values, because whether or
not a value is "in" the range depends on a specific sort order.

Actually, you'd probably even loose the possibility of having a
normalization function for discrete base types (which makes sure
that we know that "[1,2]" is the same as "[1,3)"), because it's
hard to image one normalization function that works sensibly for
two different orderings.

So by doing that, you effectively turn a RANGE into a quadruple
(lower type, lower_included bool, upper type, upper_included bool).

best regards,
Florian Pflug



pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Boolean operators without commutators vs. ALL/ANY
Next
From: Tom Lane
Date:
Subject: Re: Patch - Debug builds without optimization