summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;