Loading mysql-test/r/ndb_index_unique.result +45 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,51 @@ a b c 7 8 3 8 2 3 drop table t1; CREATE TABLE t1 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned, c int unsigned, UNIQUE bc(b,c) ) engine = ndb; insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL); select * from t1 use index (bc) where b IS NULL order by a; a b c 2 NULL 2 3 NULL NULL select * from t1 use index (bc)order by a; a b c 1 1 1 2 NULL 2 3 NULL NULL 4 4 NULL select * from t1 use index (bc) order by a; a b c 1 1 1 2 NULL 2 3 NULL NULL 4 4 NULL select * from t1 use index (PRIMARY) where b IS NULL order by a; a b c 2 NULL 2 3 NULL NULL select * from t1 use index (bc) where b IS NULL order by a; a b c 2 NULL 2 3 NULL NULL select * from t1 use index (bc) where b IS NULL and c IS NULL order by a; a b c select * from t1 use index (bc) where b IS NULL and c = 2 order by a; a b c select * from t1 use index (bc) where b < 4 order by a; a b c 1 1 1 select * from t1 use index (bc) where b IS NOT NULL order by a; a b c 1 1 1 4 4 NULL insert into t1 values(5,1,1); ERROR 23000: Duplicate entry '5' for key 1 drop table t1; CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned not null, Loading mysql-test/t/ndb_index_unique.test +26 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,32 @@ select * from t1 order by a; drop table t1; # # Indexing NULL values # CREATE TABLE t1 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned, c int unsigned, UNIQUE bc(b,c) ) engine = ndb; insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL); select * from t1 use index (bc) where b IS NULL order by a; select * from t1 use index (bc)order by a; select * from t1 use index (bc) order by a; select * from t1 use index (PRIMARY) where b IS NULL order by a; select * from t1 use index (bc) where b IS NULL order by a; select * from t1 use index (bc) where b IS NULL and c IS NULL order by a; select * from t1 use index (bc) where b IS NULL and c = 2 order by a; select * from t1 use index (bc) where b < 4 order by a; select * from t1 use index (bc) where b IS NOT NULL order by a; -- error 1062 insert into t1 values(5,1,1); drop table t1; # # Show use of UNIQUE USING HASH indexes Loading Loading
mysql-test/r/ndb_index_unique.result +45 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,51 @@ a b c 7 8 3 8 2 3 drop table t1; CREATE TABLE t1 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned, c int unsigned, UNIQUE bc(b,c) ) engine = ndb; insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL); select * from t1 use index (bc) where b IS NULL order by a; a b c 2 NULL 2 3 NULL NULL select * from t1 use index (bc)order by a; a b c 1 1 1 2 NULL 2 3 NULL NULL 4 4 NULL select * from t1 use index (bc) order by a; a b c 1 1 1 2 NULL 2 3 NULL NULL 4 4 NULL select * from t1 use index (PRIMARY) where b IS NULL order by a; a b c 2 NULL 2 3 NULL NULL select * from t1 use index (bc) where b IS NULL order by a; a b c 2 NULL 2 3 NULL NULL select * from t1 use index (bc) where b IS NULL and c IS NULL order by a; a b c select * from t1 use index (bc) where b IS NULL and c = 2 order by a; a b c select * from t1 use index (bc) where b < 4 order by a; a b c 1 1 1 select * from t1 use index (bc) where b IS NOT NULL order by a; a b c 1 1 1 4 4 NULL insert into t1 values(5,1,1); ERROR 23000: Duplicate entry '5' for key 1 drop table t1; CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned not null, Loading
mysql-test/t/ndb_index_unique.test +26 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,32 @@ select * from t1 order by a; drop table t1; # # Indexing NULL values # CREATE TABLE t1 ( a int unsigned NOT NULL PRIMARY KEY, b int unsigned, c int unsigned, UNIQUE bc(b,c) ) engine = ndb; insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL); select * from t1 use index (bc) where b IS NULL order by a; select * from t1 use index (bc)order by a; select * from t1 use index (bc) order by a; select * from t1 use index (PRIMARY) where b IS NULL order by a; select * from t1 use index (bc) where b IS NULL order by a; select * from t1 use index (bc) where b IS NULL and c IS NULL order by a; select * from t1 use index (bc) where b IS NULL and c = 2 order by a; select * from t1 use index (bc) where b < 4 order by a; select * from t1 use index (bc) where b IS NOT NULL order by a; -- error 1062 insert into t1 values(5,1,1); drop table t1; # # Show use of UNIQUE USING HASH indexes Loading