From 196528eb42c843ca800b81be27a79c7c4806a057 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov <holyfoot@askmonty.org> Date: Sun, 14 Jun 2015 18:54:13 +0500 Subject: MDEV-8212 alter table - failing to ADD PRIMARY KEY IF NOT EXISTS when existing index of same as column name. The default name for the primary key is rather 'PRIMARY' instead of the indexed column name. --- mysql-test/t/alter_table.test | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/t/alter_table.test') diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 416c73009e6..cbb73bbb3d4 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1326,6 +1326,14 @@ SHOW CREATE TABLE t2; DROP TABLE t2; DROP TABLE t1; +CREATE TABLE t1 ( + `transaction_id` int(11) NOT NULL DEFAULT '0', + KEY `transaction_id` (`transaction_id`)); +ALTER TABLE t1 DROP KEY IF EXISTS transaction_id, ADD PRIMARY KEY IF NOT EXISTS (transaction_id); +SHOW CREATE TABLE t1; + +DROP TABLE t1; + --echo # Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't --echo # identify correct column name. --echo # -- cgit v1.2.1