diff --git a/mysql-test/innodb-index.result b/mysql-test/innodb-index.result index 858ce470627..d1962ec2c96 100644 --- a/mysql-test/innodb-index.result +++ b/mysql-test/innodb-index.result @@ -589,122 +589,6 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=ucs2; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); -commit; -alter table t1 add unique index (b); -ERROR 23000: Duplicate entry '2' for key 'b' -insert into t1 values(8,9,'fff','fff'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 -alter table t1 add index (b); -insert into t1 values(10,10,'kkk','iii'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 6 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 -alter table t1 add unique index (c), add index (d); -insert into t1 values(11,11,'aaa','mmm'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -select * from t1 force index(c) order by c; -a b c d -11 11 aaa mmm -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -select * from t1 force index(d) order by d; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 7 -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 21 NULL 7 -explain select * from t1 force index(d) order by d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL d 43 NULL 7 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `c` (`c`), - KEY `b` (`b`), - KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; create table t1(a int not null, b int) engine = innodb; insert into t1 values (1,1),(1,1),(1,1),(1,1); alter table t1 add unique index (a); diff --git a/mysql-test/innodb-index.test b/mysql-test/innodb-index.test index e8a374c163c..d776d8830b4 100644 --- a/mysql-test/innodb-index.test +++ b/mysql-test/innodb-index.test @@ -159,9 +159,6 @@ drop table t2,t4,t3,t1; -- let charset = utf8 -- source include/innodb-index.inc --- let charset = ucs2 --- source include/innodb-index.inc - create table t1(a int not null, b int) engine = innodb; insert into t1 values (1,1),(1,1),(1,1),(1,1); --error ER_DUP_ENTRY diff --git a/mysql-test/innodb-index_ucs2.result b/mysql-test/innodb-index_ucs2.result new file mode 100644 index 00000000000..c8a1e8c7da1 --- /dev/null +++ b/mysql-test/innodb-index_ucs2.result @@ -0,0 +1,116 @@ +create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=ucs2; +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); +commit; +alter table t1 add unique index (b); +ERROR 23000: Duplicate entry '2' for key 'b' +insert into t1 values(8,9,'fff','fff'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +alter table t1 add index (b); +insert into t1 values(10,10,'kkk','iii'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 6 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +alter table t1 add unique index (c), add index (d); +insert into t1 values(11,11,'aaa','mmm'); +select * from t1; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +select * from t1 force index(b) order by b; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +select * from t1 force index(c) order by c; +a b c d +11 11 aaa mmm +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +select * from t1 force index(d) order by d; +a b c d +1 1 ab ab +2 2 ac ac +3 2 ad ad +4 4 afe afe +8 9 fff fff +10 10 kkk iii +11 11 aaa mmm +explain select * from t1 force index(b) order by b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL b 5 NULL 7 +explain select * from t1 force index(c) order by c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL c 21 NULL 7 +explain select * from t1 force index(d) order by d; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL d 43 NULL 7 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `c` (`c`), + KEY `b` (`b`), + KEY `d` (`d`) +) ENGINE=InnoDB DEFAULT CHARSET=ucs2 +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/innodb-index_ucs2.test b/mysql-test/innodb-index_ucs2.test new file mode 100644 index 00000000000..fff9a4da1a8 --- /dev/null +++ b/mysql-test/innodb-index_ucs2.test @@ -0,0 +1,5 @@ +-- source include/have_innodb.inc +-- source include/have_ucs2.inc + +-- let charset = ucs2 +-- source include/innodb-index.inc