summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2017-02-26 23:01:23 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2017-02-26 23:01:23 +0400
commitfdeeab01c0b48b5f56e543b98decb76cb58bedbe (patch)
tree67cf19b9ed36fc2dc8ffd95dd29fa7b8e25af189
parentae142c21a5f7d17cb98f18434b397cb0190725ef (diff)
downloadmariadb-git-fdeeab01c0b48b5f56e543b98decb76cb58bedbe.tar.gz
MDEV-6390 CONVERT TO CHARACTER SET utf8 doesn't change DEFAULT CHARSET.
ALTER_CONVERT flag removed and replaced for ALTER_OPTIONS for the CONVERT TO CHARACTER SET command.
-rw-r--r--mysql-test/r/alter_table.result21
-rw-r--r--mysql-test/t/alter_table.test11
-rw-r--r--sql/sql_alter.h35
-rw-r--r--sql/sql_yacc.yy2
4 files changed, 49 insertions, 20 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 72e81895816..cac4c477b5a 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -2091,3 +2091,24 @@ Warnings:
Note 1061 Duplicate key name 'id1'
DROP TABLE t2;
DROP TABLE t1;
+#
+# MDEV-6390 CONVERT TO CHARACTER SET utf8 doesn't change DEFAULT CHARSET.
+#
+CREATE TABLE t1 (id int(11) NOT NULL, a int(11) NOT NULL, b int(11))
+ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+DROP TABLE t1;
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 6fe0f4d30ee..3670e871bb0 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1756,3 +1756,14 @@ REFERENCES t1 (id);
DROP TABLE t2;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-6390 CONVERT TO CHARACTER SET utf8 doesn't change DEFAULT CHARSET.
+--echo #
+
+CREATE TABLE t1 (id int(11) NOT NULL, a int(11) NOT NULL, b int(11))
+ ENGINE=InnoDB DEFAULT CHARSET=latin1;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/sql/sql_alter.h b/sql/sql_alter.h
index 526442e83e2..7114694124b 100644
--- a/sql/sql_alter.h
+++ b/sql/sql_alter.h
@@ -70,59 +70,56 @@ public:
// Set for DISABLE KEYS | ENABLE KEYS
static const uint ALTER_KEYS_ONOFF = 1L << 9;
- // Set for CONVERT TO CHARACTER SET
- static const uint ALTER_CONVERT = 1L << 10;
-
// Set for FORCE
// Set for ENGINE(same engine)
// Set by mysql_recreate_table()
- static const uint ALTER_RECREATE = 1L << 11;
+ static const uint ALTER_RECREATE = 1L << 10;
// Set for ADD PARTITION
- static const uint ALTER_ADD_PARTITION = 1L << 12;
+ static const uint ALTER_ADD_PARTITION = 1L << 11;
// Set for DROP PARTITION
- static const uint ALTER_DROP_PARTITION = 1L << 13;
+ static const uint ALTER_DROP_PARTITION = 1L << 12;
// Set for COALESCE PARTITION
- static const uint ALTER_COALESCE_PARTITION = 1L << 14;
+ static const uint ALTER_COALESCE_PARTITION = 1L << 13;
// Set for REORGANIZE PARTITION ... INTO
- static const uint ALTER_REORGANIZE_PARTITION = 1L << 15;
+ static const uint ALTER_REORGANIZE_PARTITION = 1L << 14;
// Set for partition_options
- static const uint ALTER_PARTITION = 1L << 16;
+ static const uint ALTER_PARTITION = 1L << 15;
// Set for LOAD INDEX INTO CACHE ... PARTITION
// Set for CACHE INDEX ... PARTITION
- static const uint ALTER_ADMIN_PARTITION = 1L << 17;
+ static const uint ALTER_ADMIN_PARTITION = 1L << 16;
// Set for REORGANIZE PARTITION
- static const uint ALTER_TABLE_REORG = 1L << 18;
+ static const uint ALTER_TABLE_REORG = 1L << 17;
// Set for REBUILD PARTITION
- static const uint ALTER_REBUILD_PARTITION = 1L << 19;
+ static const uint ALTER_REBUILD_PARTITION = 1L << 18;
// Set for partitioning operations specifying ALL keyword
- static const uint ALTER_ALL_PARTITION = 1L << 20;
+ static const uint ALTER_ALL_PARTITION = 1L << 19;
// Set for REMOVE PARTITIONING
- static const uint ALTER_REMOVE_PARTITIONING = 1L << 21;
+ static const uint ALTER_REMOVE_PARTITIONING = 1L << 20;
// Set for ADD FOREIGN KEY
- static const uint ADD_FOREIGN_KEY = 1L << 22;
+ static const uint ADD_FOREIGN_KEY = 1L << 21;
// Set for DROP FOREIGN KEY
- static const uint DROP_FOREIGN_KEY = 1L << 23;
+ static const uint DROP_FOREIGN_KEY = 1L << 22;
// Set for EXCHANGE PARITION
- static const uint ALTER_EXCHANGE_PARTITION = 1L << 24;
+ static const uint ALTER_EXCHANGE_PARTITION = 1L << 23;
// Set by Sql_cmd_alter_table_truncate_partition::execute()
- static const uint ALTER_TRUNCATE_PARTITION = 1L << 25;
+ static const uint ALTER_TRUNCATE_PARTITION = 1L << 24;
// Set for ADD [COLUMN] FIRST | AFTER
- static const uint ALTER_COLUMN_ORDER = 1L << 26;
+ static const uint ALTER_COLUMN_ORDER = 1L << 25;
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index aca579f0a98..9885cd729b4 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -7643,7 +7643,7 @@ alter_list_item:
LEX *lex= Lex;
if (lex->create_info.add_alter_list_item_convert_to_charset($5))
MYSQL_YYABORT;
- lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
+ lex->alter_info.flags|= Alter_info::ALTER_OPTIONS;
}
| create_table_options_space_separated
{