Re: enum bug - Mailing list pgsql-general
From | Joshua D. Drake |
---|---|
Subject | Re: enum bug |
Date | |
Msg-id | 56E6DE2B.3050304@commandprompt.com Whole thread Raw |
In response to | Re: enum bug (Alvaro Herrera <alvherre@2ndquadrant.com>) |
Responses |
Re: enum bug
Re: enum bug |
List | 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.
pgsql-general by date: