Need help writing exclusion constraint

Поиск
Список
Период
Сортировка
I have a table like this:

create table event(

    destination_id integer not null references destination
    (destination_id),

    starts timestamp,
    ends timestamp
);

I want to make sure that no two rows **with the same destination_id**
overlap in time.

I'm not sure how to write this exclusion constraint.  I know how to make
the constraint to prevent any two rows from overlapping, but I want to
allow rows to overlap as long as they don't have the same
destination_id.

Thanks in advance.

Matt

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

Предыдущее
От: "Andrus Moor"
Дата:
Сообщение: Re: How to generate unique invoice numbers foreach day
Следующее
От: Jorge Godoy
Дата:
Сообщение: Re: How to generate unique invoice numbers foreach day