diff --git a/mysql-test/innodb-index.result b/mysql-test/innodb-index.result index 91a9387a0a8..21e15705b33 100644 --- a/mysql-test/innodb-index.result +++ b/mysql-test/innodb-index.result @@ -46,6 +46,13 @@ t1 CREATE TABLE `t1` ( KEY `d2` (`d`), KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; +alter table t1 add unique index (c), add index (d); +ERROR HY000: Table 'test.t1#1' already exists +rename table `t1#1` to `t1#2`; +alter table t1 add unique index (c), add index (d); +ERROR HY000: Table 'test.t1#2' already exists +drop table `t1#2`; alter table t1 add unique index (c), add index (d); show create table t1; Table Create Table diff --git a/mysql-test/innodb-index.test b/mysql-test/innodb-index.test index d421530bf03..07f709eee38 100644 --- a/mysql-test/innodb-index.test +++ b/mysql-test/innodb-index.test @@ -17,6 +17,16 @@ show create table t1; alter table t1 add index (b); show create table t1; +# Check how existing tables interfere with temporary tables. +CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; + +--error 156 +alter table t1 add unique index (c), add index (d); +rename table `t1#1` to `t1#2`; +--error 156 +alter table t1 add unique index (c), add index (d); +drop table `t1#2`; + alter table t1 add unique index (c), add index (d); show create table t1; explain select * from t1 force index(c) order by c;