From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Elein <elein(at)varlena(dot)com>, GENERAL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: enum bug |
Date: | 2016-03-14 16:02:22 |
Message-ID: | CAKFQuwZBjE2mn5mFAwRcJTXgD1EAc5H-sECBM0F1_aEKz_j+JA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Mar 14, 2016 at 8:52 AM, Joshua D. Drake <jd(at)commandprompt(dot)com>
wrote:
>
> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2016-03-14 16:07:48 | Re: enum bug |
Previous Message | David G. Johnston | 2016-03-14 15:53:31 | Re: enum bug |