4 ms·
When would one use this approach versus a domain type [1]? How does it differ? [1]: https://www.postgresql.org/docs/current/domains.html https://www.postgresql
by rollulus 3y ago
When would one use this approach versus a domain type [1]? How does it differ?
[1]: https://www.postgresql.org/docs/current/domains.html https://www.postgresql.org/docs/current/domains.html
- jpmelos 3y agoThat would be an improvement on the `CHECK` constraint approach if the same `CHECK` constraint is used in multiple columns, to DRY it up. The `DOMAIN` types offer the same commands for `CHECK` constraints, namely `NOT VALID` when updating the constraint, and `VALIDATE CONSTRAINT` to make sure it is valid after having updated it.