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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7d4ed302
Commit
7d4ed302
authored
Mar 09, 2006
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more tests for bug#18040: Create unique index cause error 4243
parent
5c950043
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
20 deletions
+30
-20
mysql-test/r/ndb_index_unique.result
mysql-test/r/ndb_index_unique.result
+14
-10
mysql-test/t/ndb_index_unique.test
mysql-test/t/ndb_index_unique.test
+16
-10
No files found.
mysql-test/r/ndb_index_unique.result
View file @
7d4ed302
drop table if exists t1, t2, t3, t4, t5, t6, t7, t8;
CREATE TABLE t1 (
a int
unsigned
NOT NULL PRIMARY KEY,
b int
unsigned
not null,
c int
unsigned
,
UNIQUE
(b)
a int NOT NULL PRIMARY KEY,
b int not null,
c int,
UNIQUE
ib(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
...
...
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
a b c
3 4 6
insert into t1 values(8, 2, 3);
ERROR 23000:
Duplicate entry '8' for key 'PRIMARY
'
ERROR 23000:
Can't write, because of unique constraint, to table 't1
'
select * from t1 order by a;
a b c
1 2 3
...
...
@@ -43,6 +43,10 @@ a b c
6 7 2
7 8 3
8 2 3
alter table t1 drop index ib;
insert into t1 values(1, 2, 3);
create unique index ib on t1(b);
ERROR 23000: Can't write, because of unique constraint, to table 't1'
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
...
...
@@ -89,7 +93,7 @@ a b c
1 1 1
4 4 NULL
insert into t1 values(5,1,1);
ERROR 23000:
Duplicate entry '5' for key 'PRIMARY
'
ERROR 23000:
Can't write, because of unique constraint, to table 't1
'
drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
...
...
@@ -112,7 +116,7 @@ select * from t2 where b = 4 order by a;
a b c
3 4 6
insert into t2 values(8, 2, 3);
ERROR 23000:
Duplicate entry '8' for key 'PRIMARY
'
ERROR 23000:
Can't write, because of unique constraint, to table 't2
'
select * from t2 order by a;
a b c
1 2 3
...
...
@@ -177,7 +181,7 @@ pk a
3 NULL
4 4
insert into t1 values (5,0);
ERROR 23000:
Duplicate entry '5' for key 'PRIMARY
'
ERROR 23000:
Can't write, because of unique constraint, to table 't1
'
select * from t1 order by pk;
pk a
-1 NULL
...
...
@@ -210,7 +214,7 @@ pk a b c
0 NULL 18 NULL
1 3 19 abc
insert into t2 values(2,3,19,'abc');
ERROR 23000:
Duplicate entry '2' for key 'PRIMARY
'
ERROR 23000:
Can't write, because of unique constraint, to table 't2
'
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
...
...
@@ -630,7 +634,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
engine=ndb charset=utf8;
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
ERROR 23000:
Duplicate entry '2' for key 'PRIMARY
'
ERROR 23000:
Can't write, because of unique constraint, to table 't1
'
select a, sha1(b) from t1;
a sha1(b)
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
...
...
mysql-test/t/ndb_index_unique.test
View file @
7d4ed302
...
...
@@ -10,10 +10,10 @@ drop table if exists t1, t2, t3, t4, t5, t6, t7, t8;
#
CREATE
TABLE
t1
(
a
int
unsigned
NOT
NULL
PRIMARY
KEY
,
b
int
unsigned
not
null
,
c
int
unsigned
,
UNIQUE
(
b
)
a
int
NOT
NULL
PRIMARY
KEY
,
b
int
not
null
,
c
int
,
UNIQUE
ib
(
b
)
)
engine
=
ndbcluster
;
insert
t1
values
(
1
,
2
,
3
),
(
2
,
3
,
5
),
(
3
,
4
,
6
),
(
4
,
5
,
8
),
(
5
,
6
,
2
),
(
6
,
7
,
2
);
...
...
@@ -22,13 +22,19 @@ select * from t1 where b = 4 order by b;
insert
into
t1
values
(
7
,
8
,
3
);
select
*
from
t1
where
b
=
4
order
by
a
;
--
error
1
062
--
error
1
169
insert
into
t1
values
(
8
,
2
,
3
);
select
*
from
t1
order
by
a
;
delete
from
t1
where
a
=
1
;
insert
into
t1
values
(
8
,
2
,
3
);
select
*
from
t1
order
by
a
;
alter
table
t1
drop
index
ib
;
sleep
10
;
insert
into
t1
values
(
1
,
2
,
3
);
--
error
1169
create
unique
index
ib
on
t1
(
b
);
drop
table
t1
;
#
...
...
@@ -53,7 +59,7 @@ 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
1
062
--
error
1
169
insert
into
t1
values
(
5
,
1
,
1
);
drop
table
t1
;
...
...
@@ -76,7 +82,7 @@ select * from t2 where c = 6;
insert
into
t2
values
(
7
,
8
,
3
);
select
*
from
t2
where
b
=
4
order
by
a
;
--
error
1
062
--
error
1
169
insert
into
t2
values
(
8
,
2
,
3
);
select
*
from
t2
order
by
a
;
delete
from
t2
where
a
=
1
;
...
...
@@ -127,7 +133,7 @@ insert into t1 values (-1,NULL), (0,0), (1,NULL),(2,2),(3,NULL),(4,4);
select
*
from
t1
order
by
pk
;
--
error
1
062
--
error
1
169
insert
into
t1
values
(
5
,
0
);
select
*
from
t1
order
by
pk
;
delete
from
t1
where
a
=
0
;
...
...
@@ -146,7 +152,7 @@ insert into t2 values (-1,1,17,NULL),(0,NULL,18,NULL),(1,3,19,'abc');
select
*
from
t2
order
by
pk
;
--
error
1
062
--
error
1
169
insert
into
t2
values
(
2
,
3
,
19
,
'abc'
);
select
*
from
t2
order
by
pk
;
delete
from
t2
where
c
IS
NOT
NULL
;
...
...
@@ -315,7 +321,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
engine
=
ndb
charset
=
utf8
;
insert
into
t1
values
(
1
,
repeat
(
_utf8
0xe288ab6474
,
200
));
--
error
1
062
--
error
1
169
insert
into
t1
values
(
2
,
repeat
(
_utf8
0xe288ab6474
,
200
));
select
a
,
sha1
(
b
)
from
t1
;
...
...
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