Re: challenging constraint situation - how do I make it

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alban Hertroys <alban(at)magproductions(dot)nl>
Cc: Kenneth Downs <ken(at)secdat(dot)com>, Harald Armin Massa <haraldarminmassa(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: challenging constraint situation - how do I make it
Date: 2006-05-24 18:54:18
Message-ID: 558.1148496858@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alban Hertroys <alban(at)magproductions(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-05-24 19:00:53 Re: Clearing out old idle connections
Previous Message Jorge Godoy 2006-05-24 17:56:43 Re: [SQL] (Ab)Using schemas and inheritance