Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
bbbfd3e2
Commit
bbbfd3e2
authored
Nov 22, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added NULL value tests for UNIQUE index
parent
6c81b518
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
mysql-test/r/ndb_index_unique.result
mysql-test/r/ndb_index_unique.result
+45
-0
mysql-test/t/ndb_index_unique.test
mysql-test/t/ndb_index_unique.test
+26
-0
No files found.
mysql-test/r/ndb_index_unique.result
View file @
bbbfd3e2
...
...
@@ -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,
...
...
mysql-test/t/ndb_index_unique.test
View file @
bbbfd3e2
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment