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
3b59dd1b
Commit
3b59dd1b
authored
Jun 25, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug#4008 - merge table cannot determine what key caused "dupl. key" error
parent
02f41112
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
myisammrg/myrg_write.c
myisammrg/myrg_write.c
+2
-2
mysql-test/r/merge.result
mysql-test/r/merge.result
+18
-0
mysql-test/t/merge.test
mysql-test/t/merge.test
+8
-0
No files found.
myisammrg/myrg_write.c
View file @
3b59dd1b
...
@@ -22,9 +22,9 @@ int myrg_write(register MYRG_INFO *info, byte *rec)
...
@@ -22,9 +22,9 @@ int myrg_write(register MYRG_INFO *info, byte *rec)
{
{
/* [phi] MERGE_WRITE_DISABLED is handled by the else case */
/* [phi] MERGE_WRITE_DISABLED is handled by the else case */
if
(
info
->
merge_insert_method
==
MERGE_INSERT_TO_FIRST
)
if
(
info
->
merge_insert_method
==
MERGE_INSERT_TO_FIRST
)
return
mi_write
(
info
->
open_tables
[
0
].
table
,
rec
);
return
mi_write
(
(
info
->
current_table
=
info
->
open_tables
)
->
table
,
rec
);
else
if
(
info
->
merge_insert_method
==
MERGE_INSERT_TO_LAST
)
else
if
(
info
->
merge_insert_method
==
MERGE_INSERT_TO_LAST
)
return
mi_write
(
info
->
end_table
[
-
1
].
table
,
rec
);
return
mi_write
(
(
info
->
current_table
=
info
->
end_table
-
1
)
->
table
,
rec
);
else
/* unsupported insertion method */
else
/* unsupported insertion method */
return
(
my_errno
=
HA_ERR_WRONG_COMMAND
);
return
(
my_errno
=
HA_ERR_WRONG_COMMAND
);
}
}
mysql-test/r/merge.result
View file @
3b59dd1b
...
@@ -544,6 +544,24 @@ insert into t1 values (99,NULL);
...
@@ -544,6 +544,24 @@ insert into t1 values (99,NULL);
select * from t4 where a+0 > 90;
select * from t4 where a+0 > 90;
a b
a b
99 1
99 1
insert t5 values (1,1);
ERROR 23000: Duplicate entry '1-1' for key 1
insert t6 values (2,1);
ERROR 23000: Duplicate entry '2-1' for key 1
insert t5 values (1,1) on duplicate key update b=b+10;
insert t6 values (2,1) on duplicate key update b=b+20;
select * from t5 where a < 3;
a b
1 2
1 3
1 4
1 5
1 11
2 2
2 3
2 4
2 5
2 21
drop table t6, t5, t4, t3, t2, t1;
drop table t6, t5, t4, t3, t2, t1;
CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,1);
INSERT INTO t1 VALUES (1,1), (2,1);
...
...
mysql-test/t/merge.test
View file @
3b59dd1b
...
@@ -190,6 +190,14 @@ select * from t5 order by a,b;
...
@@ -190,6 +190,14 @@ select * from t5 order by a,b;
select
*
from
t6
order
by
a
,
b
;
select
*
from
t6
order
by
a
,
b
;
insert
into
t1
values
(
99
,
NULL
);
insert
into
t1
values
(
99
,
NULL
);
select
*
from
t4
where
a
+
0
>
90
;
select
*
from
t4
where
a
+
0
>
90
;
# bug#4008 - cannot determine a unique key that caused "dupl. key error"
--
error
1062
insert
t5
values
(
1
,
1
);
--
error
1062
insert
t6
values
(
2
,
1
);
insert
t5
values
(
1
,
1
)
on
duplicate
key
update
b
=
b
+
10
;
insert
t6
values
(
2
,
1
)
on
duplicate
key
update
b
=
b
+
20
;
select
*
from
t5
where
a
<
3
;
drop
table
t6
,
t5
,
t4
,
t3
,
t2
,
t1
;
drop
table
t6
,
t5
,
t4
,
t3
,
t2
,
t1
;
CREATE
TABLE
t1
(
a
int
(
11
)
NOT
NULL
default
'0'
,
b
int
(
11
)
NOT
NULL
default
'0'
,
PRIMARY
KEY
(
a
,
b
))
ENGINE
=
MyISAM
;
CREATE
TABLE
t1
(
a
int
(
11
)
NOT
NULL
default
'0'
,
b
int
(
11
)
NOT
NULL
default
'0'
,
PRIMARY
KEY
(
a
,
b
))
ENGINE
=
MyISAM
;
...
...
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