Two tables share a user_id
, a tstzrange
called period
, then each have another column called category
and place_id
respectively.
Both have constraints allowing a user to only have one 'other column' value at any time:
user_id | integer | not null
period | tstzrange | not null
category | character varying(16) |
"category_events_user_id_period_excl" EXCLUDE USING gist (user_id WITH =, period WITH &&)