Re: Vector type (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: Vector type (Re: challenging constraint situation - how do I make it)
Date: 2006-05-26 13:20:28
Message-ID: 25132.1148649628@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:
> Tom Lane wrote:
>> 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.

> With what I have in mind, both overlap and equality would violate the
> unique constraint. I don't quite see why someone'd want to forbid
> overlap but to allow equality; isn't not allowing equality the whole
> point of a unique constraint?

You're missing the point. Letting "~" represent the operator that
tests for interval-overlap, we can have
A --------------
B ------------------
C ----------------
so that A ~ B and B ~ C but not A ~ C. This is too much unlike normal
equality for a btree to work with "~" as the "equality" operator.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-05-26 13:25:04 Re: Incomplete dump?
Previous Message carlosreimer 2006-05-26 13:16:49 LDAP authentication