4 ms·
A Postgres feature I took way too long to discover: exclusion constraints, which is essentially "unique by some function of a column value" instead of "unique b
by Footkerchief 6y ago
A Postgres feature I took way too long to discover: exclusion constraints, which is essentially "unique by some function of a column value" instead of "unique by a column value":
https://www.postgresql.org/docs/13/ddl-constraints.html#DDL-CONSTRAINTS-EXCLUSION https://www.postgresql.org/docs/13/ddl-constraints.html#DDL-...
- darksaints 6y agoYou, probably like myself, took way too long to discover them because they have a fairly niche usage and are probably Postgres' least appropriately documented feature. It makes it hard to imagine the ways that it can be used. We should probably do something about that.
- ramraj07 6y agoI read the second description in the manual and amazed it exists. I can totally see use cases where you want "almost unique" constraints (same name, date of birth too close??)