News for hackers. Stuff that matters.
Re:Representing Enums in PostgreSQL by rollulus on Tuesday June 20, 2023 @01:08PM (#36407156)
When would one use this approach versus a domain type [1]? How does it differ?

[1]: https://www.postgresql.org/docs/current/domains.html

Re:Representing Enums in PostgreSQL by jpmelos on Tuesday June 20, 2023 @01:40PM (#36407600)
That 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.