Bug #72129 | Expose index properties through INFORMATION_SCHEMA | ||
---|---|---|---|
Submitted: | 26 Mar 2014 2:01 | ||
Reporter: | Marcos Albe (OCA) | Email Updates: | |
Status: | Open | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S4 (Feature request) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[26 Mar 2014 2:01]
Marcos Albe
[27 Mar 2014 13:55]
Pura Vida
While there is no difference that a user can query, there is a difference in behavior: when adding a second index on the same FK column, the second index is added IN ADDITION to the manually created index, but the second index REPLACES the automatically created index. The following modified code USE test; DROP TABLE IF EXISTS parent; DROP TABLE IF EXISTS child; CREATE TABLE `parent` (`a` INT NOT NULL PRIMARY KEY) ENGINE INNODB; CREATE TABLE `child` ( `a` int(11) DEFAULT NULL, KEY `fk_child` (`a`), CONSTRAINT `fk_child` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ) ENGINE=InnoDB ; SHOW CREATE TABLE child\G alter table child add key fk_child2 (a); SHOW CREATE TABLE child\G /* show both indexes fk_child and fk_child2 */ DROP TABLE child\G CREATE TABLE `child` ( `a` int(11) DEFAULT NULL, CONSTRAINT `fk_child` FOREIGN KEY (`a`) REFERENCES `parent` (`a`) ) ENGINE=InnoDB ; SHOW CREATE TABLE child\G alter table child add key fk_child2 (a); SHOW CREATE TABLE child\G /* Only show index fk_child2 */