config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/suite/innodb/r/innodb_rename_index.result

CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
ALTER TABLE t RENAME INDEX i1 TO GEN_CLUST_INDEX;
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
ALTER TABLE t RENAME INDEX i1 TO i1;
ALTER TABLE t RENAME INDEX aa TO aa;
ERROR 42000: Key 'aa' doesn't exist in table 't'
# combination: aaaa
ALTER TABLE t ADD INDEX i4(f), DROP INDEX i4, RENAME INDEX i4 TO i4;
ERROR 42000: Key 'i4' doesn't exist in table 't'
# combination: aabb
ALTER TABLE t ADD INDEX aa(f), DROP INDEX aa, RENAME INDEX i2 TO i2;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX aa, RENAME INDEX bb TO bb;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX bb TO bb;
ERROR 42000: Key 'bb' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i2 TO i2;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i2` (`c`),
  KEY `i3` (`d`),
  KEY `i4` (`e`),
  KEY `i1` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i1	f
test/t	i2	c
test/t	i3	d
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i1	f
i1	f,a
i2	c
i2	c,a
i3	d
i3	d,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
# combination: abcc
ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX cc TO cc;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX i3 TO i3;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX cc TO cc;
ERROR 42000: Key 'cc' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i3 TO i3;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i1` (`b`),
  KEY `i3` (`d`),
  KEY `i4` (`e`),
  KEY `aa` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	aa	f
test/t	i1	b
test/t	i3	d
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
aa	f
aa	f,a
i1	b
i1	b,a
i3	d
i3	d,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
# combination: abaa
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i1, RENAME INDEX aa TO aa;
ERROR 42000: Key 'aa' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i1 TO i1;
ERROR 42000: Duplicate key name 'i1'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX bb, RENAME INDEX i1 TO i1;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX aa TO aa;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
# combination: baaa
ALTER TABLE t ADD INDEX i2(f), DROP INDEX i1, RENAME INDEX i1 TO i1;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t ADD INDEX bb(f), DROP INDEX i1, RENAME INDEX i1 TO i1;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i2(f), DROP INDEX aa, RENAME INDEX aa TO aa;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX bb(f), DROP INDEX aa, RENAME INDEX aa TO aa;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), RENAME INDEX aa TO bb;
ERROR 42000: Key 'aa' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), RENAME INDEX bb TO aa;
ERROR 42000: Key 'bb' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), RENAME INDEX i2 TO aa;
ERROR 42000: Duplicate key name 'aa'
ALTER TABLE t ADD INDEX i1(f), RENAME INDEX i1 TO bb;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `bb` (`b`),
  KEY `i2` (`c`),
  KEY `i3` (`d`),
  KEY `i4` (`e`),
  KEY `i1` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	bb	b
test/t	i1	f
test/t	i2	c
test/t	i3	d
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
bb	b
bb	b,a
i1	f
i1	f,a
i2	c
i2	c,a
i3	d
i3	d,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
# combination: abba
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i2 TO i1;
ERROR 42000: Key 'i2' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i2 TO aa;
ERROR 42000: Key 'i2' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX bb, RENAME INDEX bb TO i1;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX bb TO aa;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
# combination: cabc
ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX i2 TO i3;
ERROR 42000: Duplicate key name 'i3'
ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX i2 TO i3;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX bb TO i3;
ERROR 42000: Key 'bb' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX bb TO i3;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX i2 TO cc;
ERROR 42000: Duplicate key name 'cc'
ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX i2 TO cc;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX bb TO cc;
ERROR 42000: Key 'bb' doesn't exist in table 't'
ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX bb TO cc;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t DROP INDEX i1, RENAME INDEX i1 TO bb;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t DROP INDEX aa, RENAME INDEX i2 TO aa;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t DROP INDEX aa, RENAME INDEX aa TO i2;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t DROP INDEX i1, RENAME INDEX i4 TO i1;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i2` (`c`),
  KEY `i3` (`d`),
  KEY `i1` (`e`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i1	e
test/t	i2	c
test/t	i3	d
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i1	e
i1	e,a
i2	c
i2	c,a
i3	d
i3	d,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
# combination: accb
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX i3 TO i2;
ERROR 42000: Key 'i3' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX i3 TO bb;
ERROR 42000: Key 'i3' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX cc TO i2;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX cc TO bb;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX cc TO i2;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX cc TO bb;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
# combination: aaab
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i1 TO i2;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i1 TO bb;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i1, RENAME INDEX i1 TO i2;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX aa, RENAME INDEX aa TO bb;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
# combination: abcd
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX cc TO i4;
ERROR 42000: Key 'cc' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX cc TO dd;
ERROR 42000: Key 'cc' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX cc TO i4;
ERROR 42000: Key 'cc' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX cc TO dd;
ERROR 42000: Key 'cc' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i3 TO i4;
ERROR 42000: Duplicate key name 'i4'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i3 TO dd;
ERROR 42000: Duplicate key name 'i1'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i3 TO i4;
ERROR 42000: Duplicate key name 'i4'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX i3 TO dd;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i1` (`b`),
  KEY `dd` (`d`),
  KEY `i4` (`e`),
  KEY `aa` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	aa	f
test/t	dd	d
test/t	i1	b
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
aa	f
aa	f,a
dd	d
dd	d,a
i1	b
i1	b,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
# combination: abab
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i2, RENAME INDEX i1 TO i2;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i2` (`b`),
  KEY `i3` (`d`),
  KEY `i4` (`e`),
  KEY `i1` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i1	f
test/t	i2	b
test/t	i3	d
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i1	f
i1	f,a
i2	b
i2	b,a
i3	d
i3	d,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
ALTER TABLE t ADD INDEX i1(f), DROP INDEX bb, RENAME INDEX i1 TO bb;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i2, RENAME INDEX aa TO i2;
ERROR 42000: Key 'aa' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX bb, RENAME INDEX aa TO bb;
ERROR 42000: Can't DROP 'bb'; check that column/key exists
# combination: acbc
ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX i2 TO cc;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX i2 TO cc;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX i1(f), DROP INDEX cc, RENAME INDEX bb TO cc;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX aa(f), DROP INDEX cc, RENAME INDEX bb TO cc;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX bb TO i3;
ERROR 42000: Key 'bb' doesn't exist in table 't'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i3, RENAME INDEX bb TO i3;
ERROR 42000: Key 'bb' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1(f), DROP INDEX i3, RENAME INDEX i2 TO i3;
ERROR 42000: Duplicate key name 'i1'
ALTER TABLE t ADD INDEX aa(f), DROP INDEX i3, RENAME INDEX i2 TO i3;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i1` (`b`),
  KEY `i3` (`c`),
  KEY `i4` (`e`),
  KEY `aa` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	aa	f
test/t	i1	b
test/t	i3	c
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
aa	f
aa	f,a
i1	b
i1	b,a
i3	c
i3	c,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
# combination: cacb
ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX cc TO i2;
ERROR 42000: Key 'cc' doesn't exist in table 't'
ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX cc TO i2;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX cc(f), DROP INDEX aa, RENAME INDEX cc TO bb;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX cc(f), DROP INDEX i1, RENAME INDEX cc TO bb;
ERROR 42000: Key 'cc' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX i3 TO i2;
ERROR 42000: Duplicate key name 'i2'
ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX i3 TO i2;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX i3(f), DROP INDEX aa, RENAME INDEX i3 TO bb;
ERROR 42000: Can't DROP 'aa'; check that column/key exists
ALTER TABLE t ADD INDEX i3(f), DROP INDEX i1, RENAME INDEX i3 TO bb;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i2` (`c`),
  KEY `bb` (`d`),
  KEY `i4` (`e`),
  KEY `i3` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	bb	d
test/t	i2	c
test/t	i3	f
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
bb	d
bb	d,a
i2	c
i2	c,a
i3	f
i3	f,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
# combination: ccab
ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX i1 TO i2;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX i1 TO bb;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX aa TO i2;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX cc(f), DROP INDEX cc, RENAME INDEX aa TO bb;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX i3(f), DROP INDEX cc, RENAME INDEX aa TO i2;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX i3(f), DROP INDEX cc, RENAME INDEX aa TO bb;
ERROR 42000: Can't DROP 'cc'; check that column/key exists
ALTER TABLE t ADD INDEX i3(f), DROP INDEX i3, RENAME INDEX i1 TO i2;
ERROR 42000: Duplicate key name 'i2'
ALTER TABLE t ADD INDEX i3(f), DROP INDEX i3, RENAME INDEX i1 TO bb;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `bb` (`b`),
  KEY `i2` (`c`),
  KEY `i4` (`e`),
  KEY `i3` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	bb	b
test/t	i2	c
test/t	i3	f
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
bb	b
bb	b,a
i2	c
i2	c,a
i3	f
i3	f,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
ALTER TABLE t RENAME INDEX i1 TO x;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `x` (`b`),
  KEY `i2` (`c`),
  KEY `i3` (`d`),
  KEY `i4` (`e`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i2	c
test/t	i3	d
test/t	i4	e
test/t	PRIMARY	a
test/t	x	b
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i2	c
i2	c,a
i3	d
i3	d,a
i4	e
i4	e,a
x	b
x	b,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
ALTER TABLE t RENAME INDEX i1 TO i2;
ERROR 42000: Duplicate key name 'i2'
ALTER TABLE t RENAME INDEX foo TO i1;
ERROR 42000: Key 'foo' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i9 (f), RENAME INDEX i1 TO i8;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i8` (`b`),
  KEY `i2` (`c`),
  KEY `i3` (`d`),
  KEY `i4` (`e`),
  KEY `i9` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i2	c
test/t	i3	d
test/t	i4	e
test/t	i8	b
test/t	i9	f
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i2	c
i2	c,a
i3	d
i3	d,a
i4	e
i4	e,a
i8	b
i8	b,a
i9	f
i9	f,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
ALTER TABLE t ADD INDEX i1 (f), RENAME INDEX i1 TO i9;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i9` (`b`),
  KEY `i2` (`c`),
  KEY `i3` (`d`),
  KEY `i4` (`e`),
  KEY `i1` (`f`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i1	f
test/t	i2	c
test/t	i3	d
test/t	i4	e
test/t	i9	b
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i1	f
i1	f,a
i2	c
i2	c,a
i3	d
i3	d,a
i4	e
i4	e,a
i9	b
i9	b,a
DROP TABLE t;
CREATE TABLE t (
a INT,
b INT,
c INT,
d INT,
e INT,
f INT,
PRIMARY KEY (a),
INDEX i1 (b),
INDEX i2 (c),
INDEX i3 (d),
INDEX i4 (e)
) ENGINE=INNODB;
INSERT INTO t SET a = 1;
ALTER TABLE t ADD INDEX foo (f), RENAME INDEX i1 TO foo;
ERROR 42000: Duplicate key name 'foo'
ALTER TABLE t ADD INDEX i1 (f), RENAME INDEX i1 TO foo, DROP INDEX i1;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t ADD INDEX i1 (f), RENAME INDEX i1 TO foo, DROP INDEX foo;
ERROR 42000: Can't DROP 'foo'; check that column/key exists
ALTER TABLE t ADD INDEX foo (f), RENAME INDEX foo TO bar, DROP INDEX foo;
ERROR 42000: Can't DROP 'foo'; check that column/key exists
ALTER TABLE t RENAME INDEX i1 TO x, RENAME INDEX i2 TO x;
ERROR 42000: Duplicate key name 'x'
ALTER TABLE t RENAME INDEX i1 TO x, RENAME INDEX i1 TO y;
ERROR 42000: Key 'i1' doesn't exist in table 't'
ALTER TABLE t RENAME INDEX i1 TO x, RENAME INDEX i1 TO x;
ERROR 42000: Key 'i1' doesn't exist in table 't'
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL,
  `d` int(11) DEFAULT NULL,
  `e` int(11) DEFAULT NULL,
  `f` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i1` (`b`),
  KEY `i2` (`c`),
  KEY `i3` (`d`),
  KEY `i4` (`e`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i1	b
test/t	i2	c
test/t	i3	d
test/t	i4	e
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i1	b
i1	b,a
i2	c
i2	c,a
i3	d
i3	d,a
i4	e
i4	e,a
DROP TABLE t;
CREATE TABLE t (
c1 INT NOT NULL,
c2 INT NOT NULL,
c3 INT,
c4 INT,
PRIMARY KEY (c1),
INDEX i1 (c3),
INDEX i2 (c4)
) ENGINE=INNODB;
INSERT INTO t SET c1=1, c2=2;
ALTER TABLE t DROP PRIMARY KEY, ADD PRIMARY KEY (c2), RENAME INDEX i1 TO x;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `c1` int(11) NOT NULL,
  `c2` int(11) NOT NULL,
  `c3` int(11) DEFAULT NULL,
  `c4` int(11) DEFAULT NULL,
  PRIMARY KEY (`c2`),
  KEY `x` (`c3`),
  KEY `i2` (`c4`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i2	c4
test/t	PRIMARY	c2
test/t	x	c3
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	c2
i2	c4
i2	c4,c2
x	c3
x	c3,c2
ALTER TABLE t RENAME INDEX i2 TO y, ROW_FORMAT=REDUNDANT;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `c1` int(11) NOT NULL,
  `c2` int(11) NOT NULL,
  `c3` int(11) DEFAULT NULL,
  `c4` int(11) DEFAULT NULL,
  PRIMARY KEY (`c2`),
  KEY `x` (`c3`),
  KEY `y` (`c4`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	PRIMARY	c2
test/t	x	c3
test/t	y	c4
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	c2
x	c3
x	c3,c2
y	c4
y	c4,c2
DROP TABLE t;
CREATE TABLE t (
c1 INT NOT NULL,
c2 INT,
c3 INT,
INDEX i1 (c2),
INDEX i2 (c3)
) ENGINE=INNODB;
INSERT INTO t SET c1=1;
ALTER TABLE t ADD PRIMARY KEY (c1), RENAME INDEX i1 TO x;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `c1` int(11) NOT NULL,
  `c2` int(11) DEFAULT NULL,
  `c3` int(11) DEFAULT NULL,
  PRIMARY KEY (`c1`),
  KEY `x` (`c2`),
  KEY `i2` (`c3`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i2	c3
test/t	PRIMARY	c1
test/t	x	c2
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	c1
i2	c3
i2	c3,c1
x	c2
x	c2,c1
DROP TABLE t;
CREATE TABLE t (a INT, INDEX iiiii (a)) ENGINE=INNODB;
INSERT INTO t SET a=NULL;
ALTER TABLE t RENAME INDEX iiiii TO i;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
ALTER TABLE t RENAME INDEX i TO iiiii;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
ALTER TABLE t RENAME INDEX iiiii TO i;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
ALTER TABLE t RENAME INDEX i TO iiiii;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 0
DROP TABLE t;
CREATE TABLE t (a INT, b INT, PRIMARY KEY (a), INDEX i1 (b)) ENGINE=INNODB;
INSERT INTO t SET a=1;
RENAME TABLE mysql.innodb_index_stats TO mysql.innodb_index_stats_;
ALTER TABLE t RENAME INDEX i1 TO i7;
affected rows: 0
info: Records: 0  Duplicates: 0  Warnings: 1
Warnings:
Warning	1025	Error renaming an index of table 't' from 'i1' to 'i7' in InnoDB persistent statistics storage: Persistent statistics do not exist
RENAME TABLE mysql.innodb_index_stats_ TO mysql.innodb_index_stats;
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TABLE `t` (
  `a` int(11) NOT NULL,
  `b` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`),
  KEY `i7` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT
t.name AS table_name,
i.name AS index_name,
f.name AS column_name
FROM
information_schema.innodb_sys_tables t,
information_schema.innodb_sys_indexes i,
information_schema.innodb_sys_fields f
WHERE
t.name LIKE '%/t' AND
t.table_id = i.table_id AND
i.index_id = f.index_id
ORDER BY 1, 2, 3;
table_name	index_name	column_name
test/t	i7	b
test/t	PRIMARY	a
SELECT index_name, stat_description
FROM mysql.innodb_index_stats
WHERE table_name = 't' AND stat_name LIKE 'n_diff%'
ORDER BY 1, 2;
index_name	stat_description
PRIMARY	a
i1	b
i1	b,a
DROP TABLE t;

Man Man