From: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Michael Fuhr <mike(at)fuhr(dot)org>, ted(at)php(dot)net, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: enums |
Date: | 2005-10-28 18:23:27 |
Message-ID: | 20051028182327.GK13187@pervasive.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Oct 27, 2005 at 10:34:57PM -0400, Andrew Dunstan wrote:
>
>
> Jim C. Nasby wrote:
>
> >On Thu, Oct 27, 2005 at 09:45:05PM -0400, Andrew Dunstan wrote:
> >
> >
> >>Jim C. Nasby wrote:
> >>
> >>
> >>
> >>>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.
> >>>
> >>>
> >>>
> >>>
> >>It would just be a standard "ALTER TABLE foo ALTER COLUMN bar TYPE
> >>newtype USING expression" operation. You would write a function that
> >>took a value of the old type and returned a value of the new type and
> >>use a cll to that function in the expression. Since these would be named
> >>types, unlike the case in mysql where they are anonymously defined
> >>inline, this would present no difficulties at all.
> >>
> >>
> >
> >But why force a re-write of the entire table just to change the name of
> >something?
> >
> >
>
> Because you are not just changing the name of something.
No, I was refering specifically to the case of wanting to rename
something. IE: you setup an enum for sky colors (blue, black), and then
the PHB issues an edict that the daytime sky is now green. In this case
you (or at least I) don't want to define a new enum, I just want to
change 'blue' to 'green' in that enum. There's no reason it needs to hit
the table at all.
--
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
From | Date | Subject | |
---|---|---|---|
Next Message | Jim C. Nasby | 2005-10-28 18:30:51 | Re: pl/pgsql breakage in 8.1b4? |
Previous Message | Jim C. Nasby | 2005-10-28 18:20:51 | Re: enums |