Bug #7472 Renaming column name not reflecting in indices/foreign keys
Submitted: 22 Dec 2004 5:28 Modified: 25 Aug 2005 11:28
Reporter: Mark Junker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.1.3 OS:Microsoft Windows (WinXP Pro SP2)
Assigned to: Vladimir Kolesnikov CPU Architecture:Any

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

when you rename a column in the "Table Editor" window, the column name will not change in foreign keys and non-primary indices.

Regards,
Mark

How to repeat:
1. Create a table with the following statement:

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

2. Open the table editor window for this newly created table.
3. Create new index (Index_2) with 'test6' as index column.
4. Rename the column 'test6' to 'test6_x'
5. Apply the changes

The statement you get is:
ALTER TABLE `test`.`test5` CHANGE COLUMN `test6` `test6_x` INTEGER UNSIGNED NOT NULL DEFAULT 0,
 ADD INDEX `Index_2`(`test6`);

But the correct statement would be:
ALTER TABLE `test`.`test5` CHANGE COLUMN `test6` `test6_x` INTEGER UNSIGNED NOT NULL DEFAULT 0,
 ADD INDEX `Index_2`(`test6_x`);
[22 Dec 2004 14:16] Victoria Reznichenko
Verified with v1.1.4
[25 Aug 2005 11:28] 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