summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/alter_table.result4
-rw-r--r--mysql-test/t/alter_table.test11
2 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 581ce66a3d4..90dde034e10 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -1366,3 +1366,7 @@ ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used le
CREATE INDEX i2 ON t1 (a(20));
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
DROP TABLE t1;
+CREATE TABLE t1 (id int);
+INSERT INTO t1 VALUES (1), (2);
+ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
+DROP TABLE t1;
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 54c662bccf2..d7f7a12cbf8 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1117,3 +1117,14 @@ CREATE INDEX i2 ON t1 (a(20));
# cleanup
DROP TABLE t1;
+
+#
+# Bug #45052 ALTER TABLE ADD COLUMN crashes server with multiple foreign key columns
+# The alter table fails if 2 or more new fields added and
+# also added a key with these fields
+#
+CREATE TABLE t1 (id int);
+INSERT INTO t1 VALUES (1), (2);
+ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
+DROP TABLE t1;
+