Loading mysql-test/r/myisam.result +1 −0 Original line number Diff line number Diff line Loading @@ -529,6 +529,7 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A NULL NULL NULL YES BTREE disabled create table t2 (a int); set @@rand_seed1=31415926,@@rand_seed2=2718281828; insert t1 select * from t2; show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Loading mysql-test/r/ndb_index_unique.result +7 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,13 @@ a b c 7 8 3 8 2 3 drop table t2; CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned, UNIQUE USING HASH (b, c) ) engine=ndbcluster; ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL CREATE TABLE t3 ( a int unsigned NOT NULL, b int unsigned not null, Loading mysql-test/r/subselect.result +15 −0 Original line number Diff line number Diff line Loading @@ -1990,3 +1990,18 @@ ac 700 NULL drop tables t1,t2; create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where drop table t1; mysql-test/t/myisam.test +2 −1 Original line number Diff line number Diff line Loading @@ -498,11 +498,12 @@ alter table t1 disable keys; show keys from t1; create table t2 (a int); let $i=1000; set @@rand_seed1=31415926,@@rand_seed2=2718281828; --disable_query_log while ($i) { dec $i; eval insert t2 values (rand()*100000); insert t2 values (rand()*100000); } --enable_query_log insert t1 select * from t2; Loading mysql-test/t/ndb_index_unique.test +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ select * from t2 order by a; drop table t2; -- error 1121 CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned, UNIQUE USING HASH (b, c) ) engine=ndbcluster; # # Show use of PRIMARY KEY USING HASH indexes # Loading Loading
mysql-test/r/myisam.result +1 −0 Original line number Diff line number Diff line Loading @@ -529,6 +529,7 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 a 1 a A NULL NULL NULL YES BTREE disabled create table t2 (a int); set @@rand_seed1=31415926,@@rand_seed2=2718281828; insert t1 select * from t2; show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Loading
mysql-test/r/ndb_index_unique.result +7 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,13 @@ a b c 7 8 3 8 2 3 drop table t2; CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned, UNIQUE USING HASH (b, c) ) engine=ndbcluster; ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL CREATE TABLE t3 ( a int unsigned NOT NULL, b int unsigned not null, Loading
mysql-test/r/subselect.result +15 −0 Original line number Diff line number Diff line Loading @@ -1990,3 +1990,18 @@ ac 700 NULL drop tables t1,t2; create table t1 (a int not null, b int not null, c int, primary key (a,b)); insert into t1 values (1,1,1), (2,2,2), (3,3,3); set @b:= 0; explain select sum(a) from t1 where b > @b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index set @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where drop table t1;
mysql-test/t/myisam.test +2 −1 Original line number Diff line number Diff line Loading @@ -498,11 +498,12 @@ alter table t1 disable keys; show keys from t1; create table t2 (a int); let $i=1000; set @@rand_seed1=31415926,@@rand_seed2=2718281828; --disable_query_log while ($i) { dec $i; eval insert t2 values (rand()*100000); insert t2 values (rand()*100000); } --enable_query_log insert t1 select * from t2; Loading
mysql-test/t/ndb_index_unique.test +8 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,14 @@ select * from t2 order by a; drop table t2; -- error 1121 CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned, UNIQUE USING HASH (b, c) ) engine=ndbcluster; # # Show use of PRIMARY KEY USING HASH indexes # Loading