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