Re: enum bug
От | David G. Johnston |
---|---|
Тема | Re: enum bug |
Дата | |
Msg-id | CAKFQuwZBjE2mn5mFAwRcJTXgD1EAc5H-sECBM0F1_aEKz_j+JA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: enum bug ("Joshua D. Drake" <jd@commandprompt.com>) |
Ответы |
Re: enum bug
|
Список | pgsql-general |
If improved enough, maybe we could get to a
point where they could actually be used; otherwise why the heck did we
let the feature in the database in the first place? I think all these
"use a lookup table, you silly!" answers are missing the point.
1. I thought ENUMS were not needed in the first place. I still do.
2. I never called anyone silly, nor was I derogatory or dismissive. I offered, my solution to this problem because ENUMS are a pain in the butt and have been since the original implementation. I have yet to see a valid reason to use them instead of a lookup table. I have even written articles about the three basic solutions:
https://www.commandprompt.com/blogs/joshua_drake/2009/01/fk_check_enum_or_domain_that_is_the_question/
The one nice thing about enums is that you get two concepts in one column - a human readable label and a system used ordering.
i.e., "SELECT enum_value FROM tbl ORDER BY enum_value" actually
gives you a meaningful order without having to carry around, or relink to, a lookup table to get an ordering column.
Now, this is a bit overrated since you immediately lose that ability if you export to a Spreadsheet program, or otherwise lose the ordering nature during a convert-to-text operation.
David J.
В списке pgsql-general по дате отправления: