diff --git a/mysql-test/extra/binlog_tests/ctype_cp932.test b/mysql-test/extra/binlog_tests/ctype_cp932.test
index 688d06c4dde0a88b8c4d7762fb070767cbe8a008..440ce02af9e84bb9050070742d6fb09d67b394d4 100644
--- a/mysql-test/extra/binlog_tests/ctype_cp932.test
+++ b/mysql-test/extra/binlog_tests/ctype_cp932.test
@@ -413,3 +413,17 @@ select * from t1;
 insert into t1 values ('abc');
 select * from t1;
 drop table t1;
+
+#
+# BUG#16217 - MySQL client misinterpretes multi-byte char as escape `\' 
+#
+
+# new command \C or charset
+--exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
+--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
+
+# its usage to switch internally in mysql to requested charset
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ソ'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ソ'); select * from t1;  drop table t1;"
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ソ'"
+--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ソ'"
+--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ソ'"
diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc
index 9bbf2dc0be4bc02b7ea40b8ddf45e3665fbea08d..76666cb7bc071b31f05ad66d58b582505c829d6c 100644
--- a/mysql-test/include/mix2.inc
+++ b/mysql-test/include/mix2.inc
@@ -1770,139 +1770,6 @@ disconnect a;
 disconnect b;
 }
 
-#
-# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
-#
-
-eval create table t1 (
-  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = $engine_type;
-eval create table t2 (
-  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = $engine_type;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-eval create table t1 (
-  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = $engine_type;
-eval create table t2 (
-  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = $engine_type;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-eval create table t1 (
-  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = $engine_type;
-eval create table t2 (
-  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = $engine_type;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-eval create table t1 (
-  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = $engine_type;
-eval create table t2 (
-  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = $engine_type;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-commit;
-
 # tests for bugs #9802 and #13778
 
 if ($test_foreign_keys)
@@ -2099,95 +1966,6 @@ drop table t2,t1;
 }
 # End FOREIGN KEY tests
 
-#
-# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
-#
-eval CREATE TABLE t1 (
-  ind enum('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=$engine_type DEFAULT CHARSET=utf8;
-eval CREATE TABLE t2 (
-  ind enum('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
-
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-drop table t1,t2;
-
-eval CREATE TABLE t1 (
-  ind set('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=$engine_type DEFAULT CHARSET=utf8;
-eval CREATE TABLE t2 (
-  ind set('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
-
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-drop table t1,t2;
-
-eval CREATE TABLE t1 (
-  ind bit not null,
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=$engine_type DEFAULT CHARSET=utf8;
-eval CREATE TABLE t2 (
-  ind bit not null,
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
-insert into t1 values(0,''),(1,'');
-insert into t2 values(0,''),(1,'');
-select hex(ind),hex(string1) from t1 order by string1;
-select hex(ind),hex(string1) from t2 order by string1;
-drop table t1,t2;
-
-# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
-
-eval create table t2 (
-  a int, b char(10), filler char(10), primary key(a, b(2))
-) character set utf8 engine = $engine_type;
-
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-eval create table t2 (
-  a int, b char(10), filler char(10), primary key(a, b(2))
-) character set ucs2 engine = $engine_type;
-
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-
-eval create table t1(a int not null, b char(110),primary key(a,b(100))) engine=$engine_type default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-update t1 set b = 'three' where a = 6;
-drop table t1;
-eval create table t1(a int not null, b text(110),primary key(a,b(100))) engine=$engine_type default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-update t1 set b = 'three' where a = 6;
-drop table t1;
-
 if ($test_foreign_keys)
 {
 # Ensure that <tablename>_ibfk_0 is not mistreated as a
diff --git a/mysql-test/include/mix2_ucs2.inc b/mysql-test/include/mix2_ucs2.inc
new file mode 100644
index 0000000000000000000000000000000000000000..418bc7aad746265f9d156e4ad0387fd6064b90b0
--- /dev/null
+++ b/mysql-test/include/mix2_ucs2.inc
@@ -0,0 +1,228 @@
+#
+# Tests from mix2.inc which require ucs2 character sets should go here
+#
+
+#
+# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
+#
+
+eval create table t1 (
+  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+eval create table t1 (
+  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+
+
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+eval create table t1 (
+  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+eval create table t1 (
+  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = $engine_type;
+eval create table t2 (
+  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = $engine_type;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+commit;
+
+#
+# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
+#
+eval CREATE TABLE t1 (
+  ind enum('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=utf8;
+eval CREATE TABLE t2 (
+  ind enum('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+eval CREATE TABLE t1 (
+  ind set('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=utf8;
+eval CREATE TABLE t2 (
+  ind set('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+eval CREATE TABLE t1 (
+  ind bit not null,
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=utf8;
+eval CREATE TABLE t2 (
+  ind bit not null,
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=$engine_type DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+select hex(ind),hex(string1) from t2 order by string1;
+drop table t1,t2;
+
+# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
+
+eval create table t2 (
+  a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = $engine_type;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+eval create table t2 (
+  a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = $engine_type;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+
+eval create table t1(a int not null, b char(110),primary key(a,b(100))) engine=$engine_type default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+eval create table t1(a int not null, b text(110),primary key(a,b(100))) engine=$engine_type default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+
diff --git a/mysql-test/r/binlog_stm_ctype_cp932.result b/mysql-test/r/binlog_stm_ctype_cp932.result
index ed57b87c1bac6171cdcff5925e316064f5ea5c19..01b7fab2aba5da2d16974b5c8ada727d71031465 100755
--- a/mysql-test/r/binlog_stm_ctype_cp932.result
+++ b/mysql-test/r/binlog_stm_ctype_cp932.result
@@ -11353,3 +11353,13 @@ a
 a
 a
 drop table t1;
+ソ
+ソ
+c_cp932
+ソ
+ソ
+ソ
+繧ス
+繧ス
+ソ
+ソ
diff --git a/mysql-test/r/innodb-ucs2.result b/mysql-test/r/innodb-ucs2.result
new file mode 100644
index 0000000000000000000000000000000000000000..a1c73c912b20050a9fee048044061fe74026f4ed
--- /dev/null
+++ b/mysql-test/r/innodb-ucs2.result
@@ -0,0 +1,313 @@
+create table t1 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	05630563	05630563	email
+4	0563	0563	email
+4	05612020	05612020	email
+4	01FC	01FC	email
+4	0120	0120	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	0000E400	0000E400	email
+4	0000563001FC0563	0000563001FC0563	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	05630563	05630563	email
+4	0563	0563	email
+4	05612020	05612020	email
+4	01FC	01FC	email
+4	0120	0120	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	0000E400	0000E400	email
+4	0000563001FC0563	0000563001FC0563	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	0120	0120	email
+4	01FC	01FC	email
+4	0563	0563	email
+4	0000563001FC0563	0000563001FC0563	email
+4	0000E400	0000E400	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	05612020	05612020	email
+4	05630563	05630563	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	0000E400	0000E400	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	0120	0120	email
+4	01FC	01FC	email
+4	05612020	05612020	email
+4	0563	0563	email
+1	61626364656667	61626364656667	one
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+drop table t1;
+drop table t2;
+commit;
+CREATE TABLE t1 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind)	hex(string1)
+31	
+32	
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind)	hex(string1)
+0031	
+0032	
+drop table t1,t2;
+CREATE TABLE t1 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind)	hex(string1)
+31	
+32	
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind)	hex(string1)
+0031	
+0032	
+drop table t1,t2;
+CREATE TABLE t1 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+hex(ind)	hex(string1)
+0	
+1	
+select hex(ind),hex(string1) from t2 order by string1;
+hex(ind)	hex(string1)
+0	
+1	
+drop table t1,t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set utf8 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set ucs2 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a	hex(b)
+1	61626364656667
+2	6465666768696A6B
+6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a	hex(b)
+1	61626364656667
+2	6465666768696A6B
+6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 621599df34eca288280af93fee1068ee52a2b7c3..e02c0b5fff4e70cdd2f46f6d8a67d431d2bc70bf 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -2666,215 +2666,6 @@ checksum table t1;
 Table	Checksum
 test.t1	2050879373
 drop table t1;
-create table t1 (
-a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
-4	E880BDE880BD	E880BDE880BD	six
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	05630563	05630563	email
-4	0563	0563	email
-4	05612020	05612020	email
-4	01FC	01FC	email
-4	0120	0120	email
-4	00640065	00640065	email
-4	00E400E50068	00E400E50068	email
-4	0000E400	0000E400	email
-4	0000563001FC0563	0000563001FC0563	email
-1	0061006200630064006500660067	0061006200630064006500660067	one
-3	0071007200730074007500760077	0071007200730074007500760077	three
-2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
-4	E880BDE880BD	E880BDE880BD	six
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	05630563	05630563	email
-4	0563	0563	email
-4	05612020	05612020	email
-4	01FC	01FC	email
-4	0120	0120	email
-4	00640065	00640065	email
-4	00E400E50068	00E400E50068	email
-4	0000E400	0000E400	email
-4	0000563001FC0563	0000563001FC0563	email
-1	0061006200630064006500660067	0061006200630064006500660067	one
-3	0071007200730074007500760077	0071007200730074007500760077	three
-2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
-4	E880BDE880BD	E880BDE880BD	six
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	0120	0120	email
-4	01FC	01FC	email
-4	0563	0563	email
-4	0000563001FC0563	0000563001FC0563	email
-4	0000E400	0000E400	email
-4	00640065	00640065	email
-4	00E400E50068	00E400E50068	email
-4	05612020	05612020	email
-4	05630563	05630563	email
-1	0061006200630064006500660067	0061006200630064006500660067	one
-3	0071007200730074007500760077	0071007200730074007500760077	three
-2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	0000E400	0000E400	email
-4	00640065	00640065	email
-4	00E400E50068	00E400E50068	email
-4	0120	0120	email
-4	01FC	01FC	email
-4	05612020	05612020	email
-4	0563	0563	email
-1	61626364656667	61626364656667	one
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-drop table t1;
-drop table t2;
-commit;
 set foreign_key_checks=0;
 create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
 create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
@@ -3051,109 +2842,6 @@ select hex(s1) from t2;
 hex(s1)
 12
 drop table t2,t1;
-CREATE TABLE t1 (
-ind enum('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind enum('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-hex(ind)	hex(string1)
-31	
-32	
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-hex(ind)	hex(string1)
-0031	
-0032	
-drop table t1,t2;
-CREATE TABLE t1 (
-ind set('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind set('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-hex(ind)	hex(string1)
-31	
-32	
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-hex(ind)	hex(string1)
-0031	
-0032	
-drop table t1,t2;
-CREATE TABLE t1 (
-ind bit not null,
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind bit not null,
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-insert into t1 values(0,''),(1,'');
-insert into t2 values(0,''),(1,'');
-select hex(ind),hex(string1) from t1 order by string1;
-hex(ind)	hex(string1)
-0	
-1	
-select hex(ind),hex(string1) from t2 order by string1;
-hex(ind)	hex(string1)
-0	
-1	
-drop table t1,t2;
-create table t2 (
-a int, b char(10), filler char(10), primary key(a, b(2)) 
-) character set utf8 engine = innodb;
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t2 (
-a int, b char(10), filler char(10), primary key(a, b(2)) 
-) character set ucs2 engine = innodb;
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-a	hex(b)
-1	61626364656667
-2	6465666768696A6B
-6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
-7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
-update t1 set b = 'three' where a = 6;
-drop table t1;
-create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-a	hex(b)
-1	61626364656667
-2	6465666768696A6B
-6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
-7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
-update t1 set b = 'three' where a = 6;
-drop table t1;
 CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
 CREATE TABLE t2(a INT) ENGINE=InnoDB;
 ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result
index 45b4784251a4aa37226c87c694b8951ce1ae8c88..f8bebe4fd7969798c6e0d56af060e1e6dae6a909 100644
--- a/mysql-test/r/mix2_myisam.result
+++ b/mysql-test/r/mix2_myisam.result
@@ -2058,318 +2058,6 @@ delete t1 from t1,t2 where f1=f3 and f4='cc';
 select * from t1;
 f1	f2
 drop table t1,t2;
-create table t1 (
-a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = MyISAM;
-create table t2 (
-a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = MyISAM;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
-4	E880BDE880BD	E880BDE880BD	six
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	05612020	05612020	email
-4	0000563001FC0563	0000563001FC0563	email
-4	05630563	05630563	email
-4	0563	0563	email
-4	0120	0120	email
-4	01FC	01FC	email
-4	00E400E50068	00E400E50068	email
-4	00640065	00640065	email
-4	0000E400	0000E400	email
-1	0061006200630064006500660067	0061006200630064006500660067	one
-3	0071007200730074007500760077	0071007200730074007500760077	three
-2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = MyISAM;
-create table t2 (
-a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = MyISAM;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
-4	E880BDE880BD	E880BDE880BD	six
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	05612020	05612020	email
-4	0000563001FC0563	0000563001FC0563	email
-4	05630563	05630563	email
-4	0563	0563	email
-4	0120	0120	email
-4	01FC	01FC	email
-4	00E400E50068	00E400E50068	email
-4	00640065	00640065	email
-4	0000E400	0000E400	email
-1	0061006200630064006500660067	0061006200630064006500660067	one
-3	0071007200730074007500760077	0071007200730074007500760077	three
-2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = MyISAM;
-create table t2 (
-a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = MyISAM;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
-4	E880BDE880BD	E880BDE880BD	six
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	0000E400	0000E400	email
-4	00640065	00640065	email
-4	00E400E50068	00E400E50068	email
-4	01FC	01FC	email
-4	0120	0120	email
-4	0563	0563	email
-4	05630563	05630563	email
-4	0000563001FC0563	0000563001FC0563	email
-4	05612020	05612020	email
-1	0061006200630064006500660067	0061006200630064006500660067	one
-3	0071007200730074007500760077	0071007200730074007500760077	three
-2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = MyISAM;
-create table t2 (
-a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = MyISAM;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a	hex(b)	hex(c)	filler
-1	61626364656667	61626364656667	boo
-4	D0B1	D0B1	eight
-4	5B	5B	five
-4	E880BD	E880BD	four
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a	hex(b)	hex(c)	filler
-4	0000E400	0000E400	email
-4	00640065	00640065	email
-4	00E400E50068	00E400E50068	email
-4	01FC	01FC	email
-4	0120	0120	email
-4	0563	0563	email
-4	05612020	05612020	email
-1	61626364656667	61626364656667	one
-3	71727374757677	71727374757677	three
-2	696A6B696C6D6E	696A6B696C6D6E	two
-drop table t1;
-drop table t2;
-commit;
-CREATE TABLE t1 (
-ind enum('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind enum('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-hex(ind)	hex(string1)
-31	
-32	
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-hex(ind)	hex(string1)
-0031	
-0032	
-drop table t1,t2;
-CREATE TABLE t1 (
-ind set('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind set('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-hex(ind)	hex(string1)
-31	
-32	
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-hex(ind)	hex(string1)
-0031	
-0032	
-drop table t1,t2;
-CREATE TABLE t1 (
-ind bit not null,
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind bit not null,
-string1 varchar(250) NOT NULL,
-PRIMARY KEY  (ind)
-) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
-insert into t1 values(0,''),(1,'');
-insert into t2 values(0,''),(1,'');
-select hex(ind),hex(string1) from t1 order by string1;
-hex(ind)	hex(string1)
-0	
-1	
-select hex(ind),hex(string1) from t2 order by string1;
-hex(ind)	hex(string1)
-0	
-1	
-drop table t1,t2;
-create table t2 (
-a int, b char(10), filler char(10), primary key(a, b(2))
-) character set utf8 engine = MyISAM;
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t2 (
-a int, b char(10), filler char(10), primary key(a, b(2))
-) character set ucs2 engine = MyISAM;
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t1(a int not null, b char(110),primary key(a,b(100))) engine=MyISAM default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-a	hex(b)
-1	61626364656667
-2	6465666768696A6B
-6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
-7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
-update t1 set b = 'three' where a = 6;
-drop table t1;
-create table t1(a int not null, b text(110),primary key(a,b(100))) engine=MyISAM default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-a	hex(b)
-1	61626364656667
-2	6465666768696A6B
-6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
-7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
-update t1 set b = 'three' where a = 6;
-drop table t1;
 create table t1(a int not null, b int, c int, d int, primary key(a)) engine=MyISAM;
 insert into t1(a) values (1),(2),(3);
 commit;
diff --git a/mysql-test/r/mix2_myisam_ucs2.result b/mysql-test/r/mix2_myisam_ucs2.result
new file mode 100644
index 0000000000000000000000000000000000000000..830d3b87eb5c3d73a9ce28afb05256f94fdeb988
--- /dev/null
+++ b/mysql-test/r/mix2_myisam_ucs2.result
@@ -0,0 +1,312 @@
+create table t1 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	05612020	05612020	email
+4	0000563001FC0563	0000563001FC0563	email
+4	05630563	05630563	email
+4	0563	0563	email
+4	0120	0120	email
+4	01FC	01FC	email
+4	00E400E50068	00E400E50068	email
+4	00640065	00640065	email
+4	0000E400	0000E400	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	05612020	05612020	email
+4	0000563001FC0563	0000563001FC0563	email
+4	05630563	05630563	email
+4	0563	0563	email
+4	0120	0120	email
+4	01FC	01FC	email
+4	00E400E50068	00E400E50068	email
+4	00640065	00640065	email
+4	0000E400	0000E400	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+4	E880BDD0B1E880BD	E880BDD0B1E880BD	seven
+4	E880BDE880BD	E880BDE880BD	six
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	0000E400	0000E400	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	01FC	01FC	email
+4	0120	0120	email
+4	0563	0563	email
+4	05630563	05630563	email
+4	0000563001FC0563	0000563001FC0563	email
+4	05612020	05612020	email
+1	0061006200630064006500660067	0061006200630064006500660067	one
+3	0071007200730074007500760077	0071007200730074007500760077	three
+2	0069006A006B0069006C006D006E	0069006A006B0069006C006D006E	two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = MyISAM;
+create table t2 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = MyISAM;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a	hex(b)	hex(c)	filler
+1	61626364656667	61626364656667	boo
+4	D0B1	D0B1	eight
+4	5B	5B	five
+4	E880BD	E880BD	four
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a	hex(b)	hex(c)	filler
+4	0000E400	0000E400	email
+4	00640065	00640065	email
+4	00E400E50068	00E400E50068	email
+4	01FC	01FC	email
+4	0120	0120	email
+4	0563	0563	email
+4	05612020	05612020	email
+1	61626364656667	61626364656667	one
+3	71727374757677	71727374757677	three
+2	696A6B696C6D6E	696A6B696C6D6E	two
+drop table t1;
+drop table t2;
+commit;
+CREATE TABLE t1 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind)	hex(string1)
+31	
+32	
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind)	hex(string1)
+0031	
+0032	
+drop table t1,t2;
+CREATE TABLE t1 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind)	hex(string1)
+31	
+32	
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind)	hex(string1)
+0031	
+0032	
+drop table t1,t2;
+CREATE TABLE t1 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY  (ind)
+) ENGINE=MyISAM DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+hex(ind)	hex(string1)
+0	
+1	
+select hex(ind),hex(string1) from t2 order by string1;
+hex(ind)	hex(string1)
+0	
+1	
+drop table t1,t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = MyISAM;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = MyISAM;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=MyISAM default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a	hex(b)
+1	61626364656667
+2	6465666768696A6B
+6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=MyISAM default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a	hex(b)
+1	61626364656667
+2	6465666768696A6B
+6	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7	D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 3bba1944c52479e86b1254a1d2a244a7196b8b1b..e83bbe97eaa17b76340d2f25519be7731ccf8699 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -61,16 +61,6 @@ database()
 test
 unlock tables;
 drop table t1;
-ソ
-ソ
-c_cp932
-ソ
-ソ
-ソ
-繧ス
-繧ス
-ソ
-ソ
 +----------------------+------------+--------+
 | concat('>',col1,'<') | col2       | col3   |
 +----------------------+------------+--------+
diff --git a/mysql-test/r/mysql_cp932.result b/mysql-test/r/mysql_cp932.result
new file mode 100644
index 0000000000000000000000000000000000000000..e15c97720cdc5e855b9d581c763ad6e4c9bd0fe0
--- /dev/null
+++ b/mysql-test/r/mysql_cp932.result
@@ -0,0 +1,10 @@
+ソ
+ソ
+c_cp932
+ソ
+ソ
+ソ
+繧ス
+繧ス
+ソ
+ソ
diff --git a/mysql-test/r/mysqlbinlog-cp932.result b/mysql-test/r/mysqlbinlog-cp932.result
new file mode 100644
index 0000000000000000000000000000000000000000..1640a3b16424bda7bd3909bf1410f6bdca4c02b7
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog-cp932.result
@@ -0,0 +1,19 @@
+flush logs;
+create table t3 (f text character set utf8);
+create table t4 (f text character set cp932);
+flush logs;
+rename table t3 to t03, t4 to t04;
+select HEX(f) from t03;
+HEX(f)
+E382BD
+select HEX(f) from t3;
+HEX(f)
+E382BD
+select HEX(f) from t04;
+HEX(f)
+835C
+select HEX(f) from t4;
+HEX(f)
+835C
+drop table t3, t4, t03, t04;
+End of 5.0 tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index d671b3477861de3a26c91cadb1adc5186fb62702..86a73fa5c9f7b2f099cfb40be6739a677e7d2c45 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -194,24 +194,6 @@ ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 drop table t1,t2;
 flush logs;
-create table t3 (f text character set utf8);
-create table t4 (f text character set cp932);
-flush logs;
-rename table t3 to t03, t4 to t04;
-select HEX(f) from t03;
-HEX(f)
-E382BD
-select HEX(f) from t3;
-HEX(f)
-E382BD
-select HEX(f) from t04;
-HEX(f)
-835C
-select HEX(f) from t4;
-HEX(f)
-835C
-drop table t3,t4,t03,t04;
-flush logs;
 flush logs;
 select * from t5  /* must be (1),(1) */;
 a
@@ -273,4 +255,5 @@ call p1();
 1
 1
 drop procedure p1;
+End of 5.0 tests
 flush logs;
diff --git a/mysql-test/r/sp-ucs2.result b/mysql-test/r/sp-ucs2.result
new file mode 100644
index 0000000000000000000000000000000000000000..ce6be5b0a65c7f8c3138cf8b12de5e6095d02ca4
--- /dev/null
+++ b/mysql-test/r/sp-ucs2.result
@@ -0,0 +1,14 @@
+drop function if exists bug17615|
+create table t3 (a varchar(256) unicode)|
+create function bug17615() returns varchar(256) unicode
+begin
+declare tmp_res varchar(256) unicode;
+set tmp_res= 'foo string';
+return tmp_res;
+end|
+insert into t3 values(bug17615())|
+select * from t3|
+a
+foo string
+drop function bug17615|
+drop table t3|
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 51ab8d5e139033f4fdac16d940f5991df9baaf2d..a0ebec4fa57e47143e389f4126b8e834078af7e5 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4714,20 +4714,6 @@ Handler
 Inner
 drop procedure bug15011|
 drop table t3|
-drop function if exists bug17615|
-create table t3 (a varchar(256) unicode)|
-create function bug17615() returns varchar(256) unicode
-begin
-declare tmp_res varchar(256) unicode;
-set tmp_res= 'foo string';
-return tmp_res;
-end|
-insert into t3 values(bug17615())|
-select * from t3|
-a
-foo string
-drop function bug17615|
-drop table t3|
 drop procedure if exists bug17476|
 create table t3 ( d date )|
 insert into t3 values
diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt
index a0b5b06186001b9bb129a9af5d440aa1220236be..84d2a52b6399f5abd04303fcd74749277e21e8cd 100644
--- a/mysql-test/t/ctype_ucs2_def-master.opt
+++ b/mysql-test/t/ctype_ucs2_def-master.opt
@@ -1 +1 @@
---default-collation=ucs2_unicode_ci --default-character-set=ucs2
+--default-collation=ucs2_unicode_ci --default-character-set=ucs2,latin1
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
index 00f636d79dcc9a50ff3ac3cfdfd081607ff65801..e435d1fb07df7007e7fcf3656b40d5f0ae557b69 100644
--- a/mysql-test/t/ctype_ucs2_def.test
+++ b/mysql-test/t/ctype_ucs2_def.test
@@ -1,3 +1,5 @@
+-- source include/have_ucs2.inc
+
 #
 # MySQL Bug#15276: MySQL ignores collation-server
 #
diff --git a/mysql-test/t/innodb-ucs2.test b/mysql-test/t/innodb-ucs2.test
new file mode 100644
index 0000000000000000000000000000000000000000..6647a9d08456cfee8c86a3165f84cc1608420383
--- /dev/null
+++ b/mysql-test/t/innodb-ucs2.test
@@ -0,0 +1,226 @@
+-- source include/have_innodb.inc
+-- source include/have_ucs2.inc
+
+#
+# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
+#
+
+create table t1 (
+  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+commit;
+
+#
+# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
+#
+CREATE TABLE t1 (
+  ind enum('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+  ind enum('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+  ind set('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+  ind set('0','1','2') NOT NULL default '0',
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+  ind bit not null,
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+  ind bit not null,
+  string1 varchar(250) NOT NULL,
+  PRIMARY KEY  (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+select hex(ind),hex(string1) from t2 order by string1;
+drop table t1,t2;
+
+# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
+
+create table t2 (
+  a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set utf8 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+  a int, b char(10), filler char(10), primary key(a, b(2)) 
+) character set ucs2 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 27116b1345b334d1b09859f7edf5553582ee2b3a..0937b4fd30d43bbfe6eb4422136c4e0a1c9aa7db 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1630,139 +1630,6 @@ connection default;
 disconnect a;
 disconnect b;
 
-#
-# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
-#
-
-create table t1 (
-  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-  a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-create table t1 (
-  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-  a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-create table t1 (
-  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-  a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-create table t1 (
-  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-  a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-commit;
-
 # tests for bugs #9802 and #13778
 
 # test that FKs between invalid types are not accepted
@@ -1943,94 +1810,6 @@ select a,hex(s1) from t1;
 select hex(s1) from t2;
 
 drop table t2,t1;
-#
-# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
-#
-CREATE TABLE t1 (
-  ind enum('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-  ind enum('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-drop table t1,t2;
-
-CREATE TABLE t1 (
-  ind set('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-  ind set('0','1','2') NOT NULL default '0',
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-drop table t1,t2;
-
-CREATE TABLE t1 (
-  ind bit not null,
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-  ind bit not null,
-  string1 varchar(250) NOT NULL,
-  PRIMARY KEY  (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-insert into t1 values(0,''),(1,'');
-insert into t2 values(0,''),(1,'');
-select hex(ind),hex(string1) from t1 order by string1;
-select hex(ind),hex(string1) from t2 order by string1;
-drop table t1,t2;
-
-# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
-
-create table t2 (
-  a int, b char(10), filler char(10), primary key(a, b(2)) 
-) character set utf8 engine = innodb;
-
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t2 (
-  a int, b char(10), filler char(10), primary key(a, b(2)) 
-) character set ucs2 engine = innodb;
-
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-
-create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-update t1 set b = 'three' where a = 6;
-drop table t1;
-create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-update t1 set b = 'three' where a = 6;
-drop table t1;
 
 # Ensure that <tablename>_ibfk_0 is not mistreated as a
 # generated foreign key identifier.  (Bug #16387)
diff --git a/mysql-test/t/mix2_myisam_ucs2.test b/mysql-test/t/mix2_myisam_ucs2.test
new file mode 100644
index 0000000000000000000000000000000000000000..fe22fa50238520739d85d48439a2636374c159a1
--- /dev/null
+++ b/mysql-test/t/mix2_myisam_ucs2.test
@@ -0,0 +1,27 @@
+#
+# Tests which require ucs2 character set
+#
+
+-- source include/have_ucs2.inc
+
+let $engine_type= MyISAM;
+let $other_engine_type= MEMORY;
+# There are unfortunately only MyISAM and MEMORY all time available
+# Therefore use here MEMORY again.
+let $other_engine_type1= MEMORY;
+let $other_non_trans_engine_type= MEMORY;
+let $other_non_live_chks_engine_type= MEMORY;
+# Therefore use here MyISAM again.
+let $other_live_chks_engine_type= MyISAM;
+# MyISAM does not support transactions
+let $test_transactions= 0;
+# MyISAM does not support FOREIGN KEYFOREIGN KEYs
+let $test_foreign_keys= 0;
+# MyISAM supports fulltext queries
+let $fulltext_query_unsupported= 0;
+# MyISAM internal autoincrement values are updated during updates
+let $no_autoinc_update= 0;
+# MyISAM supports keys on spatial data types
+let $no_spatial_key= 0;
+
+-- source include/mix2_ucs2.inc
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 2306d981ad8ec6527917e573f5e914a9cfc2575b..b999c5c0029424e9aad4f62db93421ecc575e2f7 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -43,20 +43,6 @@ lock tables t1 write;
 unlock tables;
 drop table t1;
 
-#
-# BUG#16217 - MySQL client misinterprets multi-byte char as escape `\' 
-#
-
-# new command \C or charset
---exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
---exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
-
-# its usage to switch internally in mysql to requested charset
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ソ'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ソ'); select * from t1;  drop table t1;"
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ソ'"
---exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ソ'"
---exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ソ'"
-
 #
 # Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
 #
diff --git a/mysql-test/t/mysql_cp932.test b/mysql-test/t/mysql_cp932.test
new file mode 100644
index 0000000000000000000000000000000000000000..60a129c3805fb11efeb0287fb577d8fd641c7278
--- /dev/null
+++ b/mysql-test/t/mysql_cp932.test
@@ -0,0 +1,22 @@
+# This test should work in embedded server after we fix mysqltest
+-- source include/not_embedded.inc
+
+#
+# Tests from mysql.test which require the cp932 character set
+#
+-- source include/have_cp932.inc
+
+#
+# BUG#16217 - MySQL client misinterprets multi-byte char as escape `\' 
+#
+
+# new command \C or charset
+--exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
+--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
+
+# its usage to switch internally in mysql to requested charset
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ソ'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ソ'); select * from t1;  drop table t1;"
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ソ'"
+--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ソ'"
+--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ソ'"
+
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
new file mode 100644
index 0000000000000000000000000000000000000000..0e0a4e2bfae6b949ae951dba787d5d35b33c462a
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog-cp932.test
@@ -0,0 +1,19 @@
+-- source include/have_cp932.inc
+
+# Bug#16217 (mysql client did not know how not switch its internal charset)
+flush logs;
+create table t3 (f text character set utf8);
+create table t4 (f text character set cp932); 
+--exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'繧ス')"
+--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ソ');"
+flush logs;
+rename table t3 to t03, t4 to t04;
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000002 | $MYSQL --default-character-set=utf8
+# original and recovered data must be equal
+select HEX(f) from t03;
+select HEX(f) from t3;
+select HEX(f) from t04;
+select HEX(f) from t4;
+
+drop table t3, t4, t03, t04;
+--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 312c33c3354c39deb8208d188082884f59ba3af0..e4dbb709c3a9cba53936116e20cb072244793410 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -110,24 +110,6 @@ select "--- reading stdin --" as "";
 --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
 drop table t1,t2;
 
-#
-# Bug#16217 (mysql client did not know how not switch its internal charset)
-#
-flush logs;
-create table t3 (f text character set utf8);
-create table t4 (f text character set cp932); 
---exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'繧ス')"
---exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ソ');"
-flush logs;
-rename table t3 to t03, t4 to t04;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL --default-character-set=utf8
-# original and recovered data must be equal
-select HEX(f) from t03;
-select HEX(f) from t3;
-select HEX(f) from t04;
-select HEX(f) from t4;
-drop table t3,t4,t03,t04;
-
 #
 #BUG#14157: utf8 encoding in binlog without set character_set_client
 #
@@ -146,7 +128,7 @@ EOF
 # must be digestable for both client and server. In 4.1 the client 
 # should use default-character-set same as the server.
 flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
 select * from t5  /* must be (1),(1) */;
 drop table t5;
 
@@ -165,7 +147,7 @@ insert into t5 values (3, date_format('2001-01-01','%W'));
 select * from t5 order by c1;
 flush logs;
 drop table t5;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
 select * from t5 order by c1;
 drop table t5;
 
@@ -188,8 +170,8 @@ call p1();
 drop procedure p1;
 --error 1305
 call p1();
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000010
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000010 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL
 call p1();
 drop procedure p1;
 
@@ -200,15 +182,14 @@ drop procedure p1;
 --exec $MYSQL_BINLOG --version 2>&1 > /dev/null
 --exec $MYSQL_BINLOG --help 2>&1 > /dev/null
 --enable_query_log
-
-# End of 5.0 tests
+--echo End of 5.0 tests
 
 #
 # Test --disable-force-if-open and --force-if-open
 #
 flush logs;
 --error 1
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null
---exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000012 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000010 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000010 >/dev/null 2>/dev/null
 
 # End of 5.1 tests
diff --git a/mysql-test/t/sp-ucs2.test b/mysql-test/t/sp-ucs2.test
new file mode 100644
index 0000000000000000000000000000000000000000..7dd88b0487197bd621d89cb009f654913476b1e0
--- /dev/null
+++ b/mysql-test/t/sp-ucs2.test
@@ -0,0 +1,28 @@
+-- source include/have_ucs2.inc
+
+delimiter |;
+
+#
+# BUG#17615: problem with character set
+#
+--disable_warnings
+drop function if exists bug17615|
+--enable_warnings
+
+create table t3 (a varchar(256) unicode)|
+
+create function bug17615() returns varchar(256) unicode
+begin
+  declare tmp_res varchar(256) unicode;
+  set tmp_res= 'foo string';
+  return tmp_res;
+end|
+
+insert into t3 values(bug17615())|
+select * from t3|
+
+drop function bug17615|
+drop table t3|
+
+
+delimiter ;|
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 38753ed3ac02c1634728700211b3734e0f3e777f..8054d2fd4be6c789dee9759c57c196f7fffc8983 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -12,6 +12,8 @@
 # Tests that destroys system tables (e.g. mysql.proc) for error testing
 #   go to sp-destruct.
 # Tests that require --with-geometry go into sp_gis.test
+# Tests that require multibyte character sets, which are not always available,
+#   go into separate files (e.g. sp-ucs2.test)
 
 use test;
 
@@ -5545,29 +5547,6 @@ drop procedure bug15011|
 drop table t3|
 
 
-#
-# BUG#17615: problem with character set
-#
---disable_warnings
-drop function if exists bug17615|
---enable_warnings
-
-create table t3 (a varchar(256) unicode)|
-
-create function bug17615() returns varchar(256) unicode
-begin
-  declare tmp_res varchar(256) unicode;
-  set tmp_res= 'foo string';
-  return tmp_res;
-end|
-
-insert into t3 values(bug17615())|
-select * from t3|
-
-drop function bug17615|
-drop table t3|
-
-
 #
 # BUG#17476: Stored procedure not returning data when it is called first
 #            time per connection
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index cbba3a934588e29865486cfe3f9515e2421abb41..b81286a75efe82533adf3a6259ab0f340837a13c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2776,10 +2776,33 @@ static int init_common_variables(const char *conf_file_name, int argc,
 #ifdef USE_REGEX
   my_regex_init(&my_charset_latin1);
 #endif
-  if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
-						    MY_CS_PRIMARY,
-						    MYF(MY_WME))))
-    return 1;
+  /*
+    Process a comma-separated character set list and choose
+    the first available character set. This is mostly for
+    test purposes, to be able to start "mysqld" even if
+    the requested character set is not available (see bug#18743).
+  */
+  for (;;)
+  {
+    char *next_character_set_name= strchr(default_character_set_name, ',');
+    if (next_character_set_name)
+      *next_character_set_name++= '\0';
+    if (!(default_charset_info=
+          get_charset_by_csname(default_character_set_name,
+                                MY_CS_PRIMARY, MYF(MY_WME))))
+    {
+      if (next_character_set_name)
+      {
+        default_character_set_name= next_character_set_name;
+        default_collation_name= 0;          // Ignore collation
+      }
+      else
+        return 1;                           // Eof of the list
+    }
+    else
+      break;
+  }
+
   if (default_collation_name)
   {
     CHARSET_INFO *default_collation;