Re: unique index for periods - Mailing list pgsql-general

From Greg Stark
Subject Re: unique index for periods
Date
Msg-id 407d949e0908200856n40379da9j1374203e82d06bed@mail.gmail.com
Whole thread Raw
In response to Re: unique index for periods  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: unique index for periods  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Thu, Aug 20, 2009 at 3:14 PM, Tom Lane<tgl@sss.pgh.pa.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

pgsql-general by date:

Previous
From: leif@crysberg.dk
Date:
Subject: Connection name on ECPGdeallocate ?
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: Generating random unique alphanumeric IDs