Hacker News new | ask | show | jobs
by woutgaze 2273 days ago
Something like this will do the job in PostgreSQL:

  CREATE TABLE reservations (
    item_id uuid,
    duration tsrange,
    EXCLUDE USING GIST (item_id WITH =, duration WITH &&)
  );
1 comments

Can this be made to work if the `id` and `duration` are in different tables (with a joining key)?