summaryrefslogtreecommitdiff
path: root/mysql-test/t/ndb_index_unique.test
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-11-30 07:41:26 +0100
committerunknown <joreland@mysql.com>2004-11-30 07:41:26 +0100
commit94a5379fbee59545e6c71aaeb4731e88cf25bece (patch)
tree4cb6fb38a60d26a644772ae3ac6e8c9f7536c08a /mysql-test/t/ndb_index_unique.test
parentd212891f6f0c0de275190f52672f3346979e07c0 (diff)
downloadmariadb-git-94a5379fbee59545e6c71aaeb4731e88cf25bece.tar.gz
ndb - fixed long overdue problems with unique indexes and null values
mysql-test/r/ndb_index_unique.result: Test of unique index and null mysql-test/t/ndb_index_unique.test: Test of unique index and null sql/ha_ndbcluster.cc: Fixed long overdue problems with unique indexes and null values
Diffstat (limited to 'mysql-test/t/ndb_index_unique.test')
-rw-r--r--mysql-test/t/ndb_index_unique.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test
index bdb23949763..5cfc069d75f 100644
--- a/mysql-test/t/ndb_index_unique.test
+++ b/mysql-test/t/ndb_index_unique.test
@@ -231,4 +231,24 @@ select * from t4 where rid = 2 order by cid;
drop table t1,t2,t3,t4,t5,t6,t7;
+# test null in indexes
+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 where b=1 and c=1;
+select * from t1 where b is null and c is null;
+select * from t1 where b is null and c = 2;
+select * from t1 where b = 4 and c is null;
+create table t8 as
+select * from t1 where (b = 1 and c = 1)
+ or (b is null and c is null)
+ or (b is null and c = 2)
+ or (b = 4 and c is null);
+select * from t8 order by a;
+select * from t1 order by a;
+drop table t1, t8;