List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:August 5 1999 9:47am
Subject:altering ENUM columns
View as plain text  
>>>>> "Richard" == Richard Antecki
> <rantecki@stripped> writes:

Richard> Hi,

Richard> I know one can add items to an ENUM safely, but is it safe to completely
Richard> change the elements in an ENUM.

Richard> For example, if I have an ENUM defined as:


Richard> I now realise that I don't really need OVER_LIMIT or OVER_BALANCE, so if I
Richard> alter the enum to be:


Richard> What happens to the columns set as FROZEN, CLOSED ... and what happens to
Richard> columns already set as OVER_LIMIT, OVER_BALANCE?

Richard> I guess this depends on the internal representation.  If they are stored
Richard> internally as integers then any alterations like this will cause values to
Richard> change, am I correct?

Richard> Thanks,

Richard> Richard


If you do an ALTER TABLE on an enum that changes, then MySQL converts
the enum to a string and then back to the new enum.  This means that
all OVER_LIMIT and OVER_BALANCE items are simply set to 0 (= wrong
enum value)

Colum NamesTom Bell5 Aug
  • Re: Colum NamesPaul DuBois5 Aug
  • Re: Colum NamesRalph Graulich5 Aug
    • altering ENUM columnsRichard Antecki5 Aug
      • altering ENUM columnsMichael Widenius5 Aug