3 ms·
Personally, I'm on the fence with enum types... I've just seen too many times when someone thought an enumeration was final and then later it had to be modified
by meddlepal 8y ago
Personally, I'm on the fence with enum types... I've just seen too many times when someone thought an enumeration was final and then later it had to be modified or we needed alternative ways to reference it other than a plain string conversion.
- jerrysievert 8y agothat's why I was surprised to see enum on that list - the rest made sense. my least favorite is when I've been called in because developers have assumed that enum's were mutable, and have started asking what all those error messages mean when they've tried to make changes.
- ecnahc515 8y agoYeah, and you can't alter them in a transaction which makes things a bit tricky.
- jarym 8y agoIt’s easy enough to add items into enums. But I agree - removing or renaming - safely - is an arse since you have to create a new enum, add it to every table with the old enum, update old to new column, drop enum, drop old columns, rename new columns to the original... yikes! Yes it can at least be scripted but then all that schema rewriting is a pain on large tables.
- fake-name 8y agoUh..... `ALTER TYPE enum ADD VALUE 'new_value';`? The only potentially problematic thing is the fact that it's not transactional.
- protomyth 8y agoI've had misgivings also, but mine related to how the application would read in the enums versus a simple reference table the app can do a select once and prep the data or we could generate code for the same.