Bug #7471 adding a column after renaming last col. not possible
Submitted: 22 Dec 2004 5:21 Modified: 25 Aug 2005 14:50
Reporter: Mark Junker Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.1.3 OS:Microsoft Windows (WinXP Pro SP2)
Assigned to: Assigned Account CPU Architecture:Any

[22 Dec 2004 5:21] Mark Junker
Description:
Hi,

the statement created by the QueryBrowser (Table Editor) is invalid if I rename the last column of a table and then add a new column in the same table editor window without applying between the two changes.

Regards,
Mark

How to repeat:
First, create the following table:

CREATE TABLE `test`.`test4` (
  `test4_id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  `test5` INTEGER UNSIGNED NOT NULL,
  PRIMARY KEY(`test4_id`)
)
TYPE = InnoDB;

Then alter the table using the context menu for this table and select "Edit Table".

Now, rename the column "test5" to "test5_x" and add a new column after test5 (with type INTEGER) and click "Apply Changes". Now it shows the following statement:

ALTER TABLE `test`.`test4` CHANGE COLUMN `test5` `test5_x` INTEGER UNSIGNED NOT NULL DEFAULT 0,
 ADD COLUMN `test6` INTEGER UNSIGNED NOT NULL AFTER `test5`;

But the correct statement should be:

ALTER TABLE `test`.`test4` CHANGE COLUMN `test5` `test5_x` INTEGER UNSIGNED NOT NULL DEFAULT 0,
 ADD COLUMN `test6` INTEGER UNSIGNED NOT NULL AFTER `test5_x`;
[22 Dec 2004 14:29] Victoria Reznichenko
Verified with version 1.1.4
[25 Aug 2005 14:50] Vladimir Kolesnikov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html