Re: challenging constraint situation - how do I make it - Mailing list pgsql-general

From Tom Lane
Subject Re: challenging constraint situation - how do I make it
Date
Msg-id 558.1148496858@sss.pgh.pa.us
Whole thread Raw
In response to Re: challenging constraint situation - how do I make it  (Alban Hertroys <alban@magproductions.nl>)
Responses Vector type (Re: challenging constraint situation - how do I make it)
List pgsql-general
Alban Hertroys <alban@magproductions.nl> writes:
> Are you refering to a 'timespan' data type that can be determined to be
> unique?

> I can see some problems there, as both value and range matter; it'd be
> similar to determining the uniqueness of an area in a rectangle (though
> 1 dimensional only, of course).

Except that what you want is to forbid overlap, not forbid equality.
This is not possible with btree-based unique indexes, because btree
will not like an opclass whose "equality" member is not transitive.

If you look in the archives you'll find previous discussion of this
point, including some blue-sky speculation about whether GiST indexes
could be made to serve the purpose.  That's a long way from being a
solution you could use today, though.

            regards, tom lane

pgsql-general by date:

Previous
From: Jorge Godoy
Date:
Subject: Re: [SQL] (Ab)Using schemas and inheritance
Next
From: Tom Lane
Date:
Subject: Re: Clearing out old idle connections