From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Range Types, discrete and/or continuous |
Date: | 2010-10-25 02:40:07 |
Message-ID: | AANLkTik2aTqHwiGa6WcY1mBGhZr68zEzMCCg5C9V+Z21@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Oct 24, 2010 at 6:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Jeff Davis <pgsql(at)j-davis(dot)com> writes:
>> Last development cycle, one of the questions that was unresolved was
>> whether to handle ranges like a discrete set (that is, [1,5) = [1,4] )
>> or continuous or both.
>
> Put me in the camp that says you need both. I really seriously dislike
> the idea of representing [1, 2) as [1, 2-epsilon], mainly because there
> is often no portable value for epsilon. Dump-and-restore would be quite
> hazardous.
+1. I think the right way to do this is - in general, a range should
be stored as a start value, a stop value, and 2 extra bits indicating
whether each end is open or closed. (And perhaps a few bits beyond
that if you want to support things like (4, inf) over a base type that
has no infinite value, which I'm not sure about.) Then you can
optionally allow a "convert-to-closed" operation, which will convert a
[3, 5) over int to [3, 4], but be undefined for float/timestamp
ranges.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-10-25 03:19:26 | Re: ask for review of MERGE |
Previous Message | Andrew Dunstan | 2010-10-25 01:59:18 | Re: why does plperl cache functions using just a bool for is_trigger |