Re: unique index for periods

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gerhard Heift <ml-postgresql-20081012-3518(at)gheift(dot)de>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: unique index for periods
Date: 2009-08-20 15:56:38
Message-ID: 407d949e0908200856n40379da9j1374203e82d06bed@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 20, 2009 at 3:14 PM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I don't believe it is possible to use a btree index for this purpose,
> because there just isn't a way to express "overlaps" as a total order.

That's true for the general case of indexing ranges but I don't think
that's true for the case where overlaps are illegal. In such a case
you could just, sorting by the start point, compare the previous
entry's end point with your start point and the next entry with your
end point.

However that's not the way unique indexes work in Postgres so
supporting that would require a lot of new abstractions and code, not
just a new opclass.

--
greg
http://mit.edu/~gsstark/resume.pdf

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2009-08-20 16:03:49 Re: Generating random unique alphanumeric IDs
Previous Message leif 2009-08-20 15:47:42 Connection name on ECPGdeallocate ?