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