It turns out it's quite straightforward to construct an "almost unique" constraint in PostgreSQL via
EXCLUDE
.
I was recently stuck in a jam in our PostgreSQL database during a feature
migration. We needed a "partial UNIQUE
" constraint and I was surprised
to find out that PostgreSQL doesn't support them1 …