On Sun, Oct 24, 2010 at 6:59 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Jeff Davis <pg...@j-davis.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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to