Re: Vector type (Re: challenging constraint situation - how do I make it)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Vector type (Re: challenging constraint situation - how do I make it)
Дата
Msg-id 25132.1148649628@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Vector type (Re: challenging constraint situation - how do I make it)  (Alban Hertroys <alban@magproductions.nl>)
Ответы Re: Vector type (Re: challenging constraint situation -  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
Alban Hertroys <alban@magproductions.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

В списке pgsql-general по дате отправления:

Предыдущее
От:
Дата:
Сообщение: LDAP authentication
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Incomplete dump?