What is better: a lookup table or an enum type?

7 points by eduard


typesanitizer

I've tried to use enums in Postgres before, and have been surprised by the limitations. E.g. if enums storage values could be specified, and you could do a scan for the tables using the enum's type to check that a case is not present, then:

  1. Dropping a case would be safe without having to modify any rows (you can imagine offering cascade/stop/etc. options).
  2. The type could internally record tombstoned cases so that you can specify new cases and their storage values in a safe way.