Re: enums

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, ted(at)php(dot)net, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: enums
Date: 2005-10-28 01:24:57
Message-ID: 20051028012457.GC63747@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 27, 2005 at 05:41:01PM -0600, Michael Fuhr wrote:
> If you want values ordered lexically then you can enumerate them
> that way. Why force that behavior on people who want to order based
> on some other criteria?

Well, I was arguing about the default behavior. I'd bet that we're going
to have a constant set of people wondering why ORDER BY is doing the
'wrong thing' when ordering an ENUM, which is why I argued that the
default behavior should be ordering based on the external type, not how
we're storing it or some other order.

But I'm clearly in the minority in this view, so I'm droping it. :)

On to other issues...

Andrew, you mentioned that if you want to change the ordering you should
just create a new type. What about if you need to change the values that
are in the enum? MySQL does (or at least did, it's been some time since
I've messed with this) a horrible job at that. There's no way to rename
anything; you have to add the new names you want, then do a bulk update,
then delete the (now old) names. IMO this is broken.

Also, if we are going to maintain ordering and mapping (presumably via
the internal number that we're storing), then I think we should expose
that, at least optionally. So for example, you should be able to define
what a specific enum value means. Not everyone will want a linear
numbering starting at 0 afterall.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

  • Re: enums at 2005-10-27 23:41:01 from Michael Fuhr

Responses

  • Re: enums at 2005-10-28 01:45:05 from Andrew Dunstan

Browse pgsql-hackers by date

  From Date Subject
Next Message Cristian Prieto 2005-10-28 01:35:41 Re: enums
Previous Message Andrew Dunstan 2005-10-28 01:12:15 relfilenode