Re: Range Types, discrete and/or continuous

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Range Types, discrete and/or continuous
Date: 2010-10-24 22:59:34
Message-ID: 22401.1287961174@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

> If we treat those as discrete, then R1 = R2, R1 contains R2, R2 contains
> R1, and R2 - R1 = R1 - R2 = empty. However, if we treat those as
> continuous, then we get a contradiction:
> R2 contains R1
> R1 does not contain R2
> R2 - R1 = ( 2009-01-01 01:00:10, 2009-01-01 01:00:10.000001 ) = empty?

This is a circular argument: your conclusion that there's a
contradiction in the concept of continuous ranges depends on the
assumption that the datatype is discrete; and with such an assumption
*of course* you can get a contradiction.

But the real problem is that if the user wants to think in terms of
continuous ranges, the only way that he can convert those to discrete
ranges is to assume an epsilon for the datatype, and he shouldn't be
forced to do that; not even if the datatype does have a well-defined
epsilon at the implementation level, which several of ours don't.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2010-10-24 23:05:29 Re: why does plperl cache functions using just a bool for is_trigger
Previous Message Tom Lane 2010-10-24 22:44:47 Re: why does plperl cache functions using just a bool for is_trigger