Bug #28427 | ALTER TABLE MODIFY COLUMN ... AFTER re-orders column names but not data | ||
---|---|---|---|
Submitted: | 14 May 2007 20:43 | Modified: | 19 Jun 2007 0:52 |
Reporter: | Kent Wise | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.1.17-beta-log | OS: | Linux (Fedora Core 5) |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
Tags: | regression |
[14 May 2007 20:43]
Kent Wise
[15 May 2007 8:00]
Sveta Smirnova
Thank you for the report. Verified as described.
[30 May 2007 6:19]
Sveta Smirnova
Bug has been introduced in version 5.1.11
[1 Jun 2007 19:59]
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/27962 ChangeSet@1.2518, 2007-06-01 23:56:45+04:00, evgen@moonbone.local +3 -0 Bug#28427: Columns were renamed instead of moving by ALTER TABLE. To avoid unnecessary work the mysql_alter_table() function takes the list of table fields and applies all changes to it (drops/moves/renames/etc). Then this function compares the new list and the old one. If changes requres only .frm to be modified then the actual data isn't copied. To detects changed types, null/not null and other columns attributes but names are compared. If a column was moved and has replaced another column with all the same attributes except name then the mysql_alter_table() function would wrongly decide that two fields were renamed instead of one column moved. This leads to avoiding of columns data copying and thus returning wrong data for the moved column and all columns after it. Now the mysql_alter_table() function forces table data copying by setting the need_copy_table flag when it finds a moved column at the stage of the modified fields list creation.
[1 Jun 2007 21:19]
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/27971 ChangeSet@1.2518, 2007-06-02 01:16:47+04:00, evgen@moonbone.local +3 -0 Bug#28427: Columns were renamed instead of moving by ALTER TABLE. To avoid unnecessary work the mysql_alter_table function takes the list of table fields and applies all changes to it (drops/moves/renames/etc). Then this function compares the new list and the old one. If the changes require only .frm to be modified then the actual data isn't copied. To detect changes all columns attributes but names are compared. When a column has been moved and has replaced another column with the same attributes except name the mysql_alter_table function wrongly decides that two fields has bee just renamed. As a result the data from the moved column and from all columns after it is not copied. Now the mysql_alter_table function forces table data copying by setting the need_copy_table flag when it finds a moved column. The flag is set at the stage when the modified fields are created.
[1 Jun 2007 21:24]
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/27972 ChangeSet@1.2518, 2007-06-02 01:21:18+04:00, evgen@moonbone.local +3 -0 Bug#28427: Columns were renamed instead of moving by ALTER TABLE. To avoid unnecessary work the mysql_alter_table function takes the list of table fields and applies all changes to it (drops/moves/renames/etc). Then this function compares the new list and the old one. If the changes require only .frm to be modified then the actual data isn't copied. To detect changes all columns attributes but names are compared. When a column has been moved and has replaced another column with the same attributes except name the mysql_alter_table function wrongly decides that two fields has been just renamed. As a result the data from the moved column and from all columns after it is not copied. Now the mysql_alter_table function forces table data copying by setting the need_copy_table flag when it finds a moved column. The flag is set at the stage when the modified fields are created.
[2 Jun 2007 17:44]
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/27991 ChangeSet@1.2520, 2007-06-02 21:43:04+04:00, sergefp@mysql.com +1 -0 BUG#28427: fix typo, s/bool/uint/
[4 Jun 2007 21:20]
Bugs System
Pushed into 5.1.20-beta
[19 Jun 2007 0:52]
Paul DuBois
Noted in 5.1.20 changelog.