Re: ENUM type

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: ENUM type
Дата
Msg-id 6EE64EF3AB31D5448D0007DD34EEB3415C2EB2@Herge.rcsinc.local
обсуждение исходный текст
Ответ на ENUM type  ("Jim C. Nasby" <decibel@decibel.org>)
Ответы Re: ENUM type  ("Jim C. Nasby" <decibel@decibel.org>)
MySQL to PostgreSQL, was ENUM type  (Chris Travers <chris@travelamericas.com>)
Список pgsql-advocacy
Jim C Nasby:
> OK, but compare the amount of work you just described to the
simplicity
> of using an enum. Enum is much easier and simpler for a developer. Of
> course in most cases the MySQL way of doing it is (as has been
> mentioned) stupid, but done in the normal, normalized way it would
> remove a fair amount of additional work on the part of a developer:
>
> - no need to manually define seperate table
create table color (color text);
insert into color values ('red'); -- etc

> - no need to define RI
references color

> - no need to manually map between ID and real values (though of course
if you use color as p-key this is unnecessary

>   we should make it easy to get the ID too)
again, in this case the color should be the id and using a surrogate key
is poor design.  If that's too much typing you have the option of a
check constraint which is superior to enum in just about every way,
particularly if encapsulated into a domain (although inferior to RI
solution, IMO).

Merlin

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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: SQL/PSM for 8.2 will offer ANSI/ISO, MySQL, and DB2 Compatibility
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: [HACKERS] Enticing interns to PostgreSQL