Re: [PATCHES] Enums patch v2
Re: [PATCHES] Enums patch v2
От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
Heikki Linnakangas wrote: > I'm sorry I missed the original discussions, but I have to ask: Why > do we want enums in core? The only potential advantage I can see over > using a look-up table and FK references is performance. The difference is that foreign-key-referenced data is part of your data whereas enums would be part of the type system used to model the data. An objection to enums on the ground that foreign keys can accomplish the same thing could be extended to object to any data type with a finite domain. -- Peter Eisentraut http://developer.postgresql.org/~petere/
Re: [PATCHES] Enums patch v2
От:
Tom Dunstan <pgsql@tomd.cc>
Дата:
Peter Eisentraut wrote: > An objection to enums on the ground that foreign keys can accomplish the > same thing could be extended to object to any data type with a finite > domain. Exactly. The extreme case is the boolean type, which could easily be represented by a two-value enum. Or, if you were feeling masochistic, a FK to a separate table. Which is easier? People regularly do stuff like having domains over finite text values, or having a FK to a separate (static) table, or using some sort of EAV. Enums are type-safe, easily ordered, relatively efficient and don't leave zillions of little static tables all over the place, a combination of attributes that none of the alternative solutions in this space present. Cheers Tom