Commit 31f5d69d authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/usr/local/home/marty/MySQL/test/mysql-4.1
parents e75f15f1 6cdf1fc9
...@@ -44,6 +44,51 @@ a b c ...@@ -44,6 +44,51 @@ a b c
7 8 3 7 8 3
8 2 3 8 2 3
drop table t1; 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 ( CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY, a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null, b int unsigned not null,
......
...@@ -30,6 +30,32 @@ select * from t1 order by a; ...@@ -30,6 +30,32 @@ select * from t1 order by a;
drop table t1; 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 # Show use of UNIQUE USING HASH indexes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment