Re: Range Types, discrete and/or continuous - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Range Types, discrete and/or continuous
Date
Msg-id 4CC53D06.3050601@enterprisedb.com
Whole thread Raw
In response to Re: Range Types, discrete and/or continuous  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 25.10.2010 01:59, Tom Lane wrote:
> Jeff Davis<pgsql@j-davis.com>  writes:
>> 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.

Let's open that up a bit:
>> R2 - R1 = ( 2009-01-01 01:00:10, 2009-01-01 01:00:10.000001 )

Correct.
>> ( 2009-01-01 01:00:10, 2009-01-01 01:00:10.000001 ) = empty?

No. The problem here is the unpack operator, ie. getting all discrete 
points within a range. It depends on the discreteness.

I'm not sure what the ramifications of that are. It means that 
PACK(UNPACK(r)) != r, and I believe many of the other operators are 
defined in terms of pack/unpack, even though there's more practical 
implementations of them. Can we get away without pack/unpack? Can we 
define all the range operations without them?

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Range Types, discrete and/or continuous
Next
From: Itagaki Takahiro
Date:
Subject: Extensible executor nodes for preparation of SQL/MED