Bug #29251 | MySQL coerces special 0 enum values to '' when ALTERing the column | ||
---|---|---|---|
Submitted: | 20 Jun 2007 21:32 | Modified: | 11 Jul 2007 22:27 |
Reporter: | Neil Skrypuch | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.0.42, 5.1, 4.1 | OS: | Linux (Gentoo) |
Assigned to: | Gleb Shchepa | CPU Architecture: | Any |
[20 Jun 2007 21:32]
Neil Skrypuch
[20 Jun 2007 21:36]
Neil Skrypuch
SQL to repeat the bug
Attachment: mysqlenumbug.sql (application/octet-stream, text), 982 bytes.
[21 Jun 2007 7:15]
Sveta Smirnova
Thank you for the report. Verified as described.
[27 Jun 2007 2:58]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/29652 ChangeSet@1.2670, 2007-06-27 03:38:14+05:00, gshchepa@gleb.loc +3 -0 Fixed bug #29251. Sometimes special 0 ENUM values was ALTERed to normal empty string ENUM values. Special 0 ENUM value has the same string representation as normal ENUM value defined as '' (empty string). The do_field_string function was used to convert ENUM data at an ALTER TABLE request, but this function doesn't care about numerical "indices" of ENUM values, i.e. do_field_string doesn't distinguish a special 0 value from an empty string value. A new copy function called do_field_enum has been added to copy special 0 ENUM values without conversion to an empty string.
[1 Jul 2007 19:57]
Bugs System
Pushed into 5.1.21-beta
[1 Jul 2007 20:02]
Bugs System
Pushed into 5.0.46
[1 Jul 2007 20:03]
Bugs System
Pushed into 4.1.24
[11 Jul 2007 22:27]
Paul DuBois
Noted in 4.1.24, 5.0.46, 5.1.21 changelogs. If an ENUM column contained '' as one of its members (represented with numeric value greater than 0), and the column contained error values (represented as 0 and displayed as ''), using ALTER TABLE to modify the column definition caused the 0 values to be given the numeric value of the non-zero '' member.