Re: enum bug

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Elein <elein(at)varlena(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, GENERAL <pgsql-general(at)postgresql(dot)org>
Subject: Re: enum bug
Date: 2016-03-14 15:52:11
Message-ID: 56E6DE2B.3050304@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/14/2016 08:48 AM, Alvaro Herrera wrote:
> Joshua D. Drake wrote:
>> On 03/11/2016 03:19 PM, Elein wrote:
>>
>>> An unused (yet) enum type cannot display the enum ranges. An empty table
>>> containing that type cannot display enum ranges.
>>>
>>> The example selects were what I did to figure out that enum_ranges only
>>> worked on existing data. Sorry if they were confusing. But the way enum
>>> values are currently displayed is confusing.
>>>
>>> Enums are evil because of the difficulty working with them. They should
>>> be used for a fixed set of valid values. Otherwise use a lookup table.
>>
>> "Otherwise use a lookup table."
>>
>> That is the solution to this problem.
>
> You know, I suspect this Elein person may know a bit about these
> database thingies(*).

I am fully aware of who Elein is.

>
> I don't think she is complaining because she cannot find her way around
> designing a garment color table; rather it seems to me she is pointing
> out actual problems in our design of the enum feature because she would
> like to see it improve.

And what I am saying, is just use a lookup table instead. If you want to
spend your valuable time on ENUM design, go for it. Nobody is stopping
you or suggesting *you* shouldn't.

> 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/

>
> (*) Yes, I'm being a bit sarcastic here, sorry about that. I actually
> learned quite a bit of database design and related topics by translating
> the "General Bits" column she used to write, many years ago.
>

Your answer presumes some personal issue with Elein. I don't know why
that is. I gave a technical answer to a technical problem.

Sincerely,

JD

--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-03-14 15:53:31 Re: enum bug
Previous Message Alvaro Herrera 2016-03-14 15:48:03 Re: enum bug