Re: WIP: Range Types

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: Range Types
Date: 2011-01-05 14:07:28
Message-ID: AANLkTinNz-4hdMhJbKrry1u68yUF3=rH1u+dokHgHtcA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 5, 2011 at 12:54 AM, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> On Tue, 2011-01-04 at 16:45 -0800, Josh Berkus wrote:
>> On 1/4/11 10:18 AM, Jeff Davis wrote:
>> > The main drawback here is that only a select group of people will be
>> > defining discrete range types at all, because it would require them to
>> > define a function first. Perhaps that's for the best, because, (as Tom
>> > pointed out) we don't want someone using floats and then specifying a
>> > granule of '0.01'.
>>
>> Frankly, I'm still not convinced that *anyone* will really need discrete
>> range types
>
> Well, *need* is a standard that can never be met. But with something
> like a date range, it's very possible that a discrete version matches
> the real-world problem more closely than a continuous one.
>
> If you use only continuous ranges, then be careful to stick with exactly
> one convention, or you will likely get wrong results (I think this point
> has already been established). That sounds easy, but consider:
>  * If you want to know whether two ranges are adjacent (a common
> requirement), then you need to use "[ )" or "( ]".
>  * If you need to map a single point into a range, the only thing that
> makes sense is "[ ]".
>  * If your query contains current_date, you'll probably want ranges that
> are either in "( ]" or "[ ]" form.
>  * If you are mixing data sets, they may use different conventions.
>
> You can work around all of these problems by making the query more
> complex (and more error-prone). But I wouldn't like to give up on
> discrete ranges for types where it really makes sense (dates, IPs,
> integers).

+1.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-01-05 14:08:49 pg_upgrade patches applied
Previous Message Robert Haas 2011-01-05 14:05:33 Re: Streaming replication as a separate permissions