summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-04-07 21:53:19 +0200
committerSergei Golubchik <sergii@pisem.net>2014-04-07 21:53:19 +0200
commit5f0c98c17bc80bd725754c1095734b97870df835 (patch)
tree88b8adc4ec1e0df412fca2260828af81d9076d73 /mysql-test
parente82a82eef8ddf52f30c8617f82764f86a27e489b (diff)
downloadmariadb-git-5f0c98c17bc80bd725754c1095734b97870df835.tar.gz
MDEV-5743 Server crashes in mysql_alter_table on an attempt to add a primary key to InnoDB table
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/alter_table_trans.result8
-rw-r--r--mysql-test/t/alter_table_trans.test12
2 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/alter_table_trans.result b/mysql-test/r/alter_table_trans.result
index 67ae4075d57..435f5abd9d0 100644
--- a/mysql-test/r/alter_table_trans.result
+++ b/mysql-test/r/alter_table_trans.result
@@ -16,3 +16,11 @@ insert t1 values (repeat('3', 8193),3,1,1);
ALTER TABLE t1 ADD PRIMARY KEY (col4(10)) , ADD UNIQUE KEY uidx (col3);
ERROR 23000: Duplicate entry '1' for key 'uidx'
DROP TABLE t1;
+CREATE TABLE t1 (a INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (2);
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ALTER TABLE t1 DROP PRIMARY KEY;
+INSERT INTO t1 VALUES (2);
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
+DROP TABLE t1;
diff --git a/mysql-test/t/alter_table_trans.test b/mysql-test/t/alter_table_trans.test
index 29b9b4c212f..19b40d84b22 100644
--- a/mysql-test/t/alter_table_trans.test
+++ b/mysql-test/t/alter_table_trans.test
@@ -32,4 +32,16 @@ insert t1 values (repeat('3', 8193),3,1,1);
ALTER TABLE t1 ADD PRIMARY KEY (col4(10)) , ADD UNIQUE KEY uidx (col3);
DROP TABLE t1;
+#
+# MDEV-5743 Server crashes in mysql_alter_table on an attempt to add a primary key to InnoDB table
+#
+
+CREATE TABLE t1 (a INT) ENGINE = InnoDB;
+INSERT INTO t1 VALUES (2);
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ALTER TABLE t1 DROP PRIMARY KEY;
+INSERT INTO t1 VALUES (2);
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+DROP TABLE t1;