summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-09-22 19:26:26 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2017-09-22 19:26:26 +0300
commitaa2340e91030e02c286f105c52985528bc4af66a (patch)
treeb30be9f530584020bf0931b061798b2da3c602c4
parent53091385f7a9d965998d0add6edcbd65ab84db04 (diff)
downloadmariadb-git-bb-10.1-MDEV-13838.tar.gz
MDEV-13640: ALTER TABLE CHANGE and ADD INDEX on auto_increment column fails with "Incorrect key file for table..."bb-10.1-MDEV-13838
Previous fixes fix also this case. Added test case.
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter-table.result15
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-table.test13
2 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result
index 3c4c00a9d01..2caa0606b12 100644
--- a/mysql-test/suite/innodb/r/innodb-alter-table.result
+++ b/mysql-test/suite/innodb/r/innodb-alter-table.result
@@ -233,3 +233,18 @@ select count(*) from t force index(primary) where d ='2017-09-15';
count(*)
16386
DROP TABLE t;
+CREATE TABLE t (
+a bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+c bigint(20) unsigned NOT NULL,
+PRIMARY KEY (a)
+) ENGINE=InnoDB ;
+ALTER TABLE t CHANGE a b BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, ADD KEY uk (c);
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `b` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `c` bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (`b`),
+ KEY `uk` (`c`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test
index cd3882c8327..16009ad0d77 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-table.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-table.test
@@ -208,3 +208,16 @@ select count(*) from t force index(primary) where d ='2017-09-15';
DROP TABLE t;
+#
+# MDEV-13640: ALTER TABLE CHANGE and ADD INDEX on auto_increment column fails with "Incorrect key file for table..."
+#
+
+CREATE TABLE t (
+a bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+c bigint(20) unsigned NOT NULL,
+PRIMARY KEY (a)
+) ENGINE=InnoDB ;
+
+ALTER TABLE t CHANGE a b BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, ADD KEY uk (c);
+SHOW CREATE TABLE t;
+DROP TABLE t;