Re: extensible enum types

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: extensible enum types
Дата
Msg-id AANLkTikpg5yDICt0ng_fPgp5iJHKCU3wPTFJyzFFxqL2@mail.gmail.com
обсуждение исходный текст
Ответ на Re: extensible enum types  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: extensible enum types  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: extensible enum types  ("Joshua D. Drake" <jd@commandprompt.com>)
Список pgsql-hackers
>> Thoughts?
>
> enum types exist as an optimisation-by-avoidance of referential
> integrity.
>
> We're a relational database, so IMHO we should spend time performance
> tuning RI.

I take the view that they exist as a way of representing enumerations
of application/domain values - if it's hard coded in the application,
it's hard coded in the database by using an enum. This is why it isn't
that big a problem that they cannot be amended - they ought to be very
static, immutable values in the first place. I still think it would be
handy to be able to append new values though, and not have to ALTER
COLUMN USING to a new enum type. Besides, using enums in place of
lookup tables doesn't really make much sense as an optimisation.

It's very cool to be able to write queries like SELECT * FROM payments
WHERE payment_type = 'cash', rather than having to recall time and
again what the PK of cash is within your lookup table.

-- 
Regards,
Peter Geoghegan


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: extensible enum types
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: extensible enum types