Re: Range Types, discrete and/or continuous

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Range Types, discrete and/or continuous
Date: 2010-10-25 08:17:10
Message-ID: 4CC53D06.3050601@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25.10.2010 01:59, Tom Lane wrote:
> Jeff Davis<pgsql(at)j-davis(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Itagaki Takahiro 2010-10-25 11:16:49 Extensible executor nodes for preparation of SQL/MED
Previous Message Gnanakumar 2010-10-25 07:36:30 pg_ctl: server does not shut down