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
11a7abc0
Commit
11a7abc0
authored
Sep 05, 2006
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge changes to the "innodb_mysql" test from MySQL AB
parent
8ac86bd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
0 deletions
+83
-0
mysql-test/innodb_mysql.result
mysql-test/innodb_mysql.result
+46
-0
mysql-test/innodb_mysql.test
mysql-test/innodb_mysql.test
+37
-0
No files found.
mysql-test/innodb_mysql.result
View file @
11a7abc0
...
...
@@ -407,3 +407,49 @@ Warnings:
Warning 1071 Specified key was too long; max key length is 765 bytes
insert into t1 values('aaa');
drop table t1;
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
`a` int(11) default NULL,
`c` int(11) default NULL,
PRIMARY KEY (`k`),
UNIQUE KEY `idx_1` (`a`)
) ENGINE=InnoDB;
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
insert into t2 ( a ) values ( 7 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
2
select * from t2;
k a c
1 6 NULL
2 7 NULL
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 1
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
last_insert_id()
1
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
last_insert_id()
11
select * from t2;
k a c
1 6 1
2 7 NULL
10 8 1
11 15 1
12 20 1
drop table t2;
mysql-test/innodb_mysql.test
View file @
11a7abc0
...
...
@@ -367,3 +367,40 @@ create table t1(f1 varchar(800) binary not null, key(f1)) engine = innodb
character
set
utf8
collate
utf8_general_ci
;
insert
into
t1
values
(
'aaa'
);
drop
table
t1
;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE": now LAST_INSERT_ID() will return the id of the updated
# row.
CREATE
TABLE
`t2`
(
`k`
int
(
11
)
NOT
NULL
auto_increment
,
`a`
int
(
11
)
default
NULL
,
`c`
int
(
11
)
default
NULL
,
PRIMARY
KEY
(
`k`
),
UNIQUE
KEY
`idx_1`
(
`a`
)
)
ENGINE
=
InnoDB
;
insert
into
t2
(
a
)
values
(
6
)
on
duplicate
key
update
c
=
ifnull
(
c
,
0
)
+
1
;
insert
into
t2
(
a
)
values
(
7
)
on
duplicate
key
update
c
=
ifnull
(
c
,
0
)
+
1
;
select
last_insert_id
();
select
*
from
t2
;
insert
into
t2
(
a
)
values
(
6
)
on
duplicate
key
update
c
=
ifnull
(
c
,
0
)
+
1
;
select
last_insert_id
();
select
*
from
t2
;
# Test of LAST_INSERT_ID() when autogenerated will fail:
# last_insert_id() should not change
insert
ignore
into
t2
values
(
null
,
6
,
1
),(
10
,
8
,
1
);
select
last_insert_id
();
# First and second autogenerated will fail, last_insert_id() should
# point to third
insert
ignore
into
t2
values
(
null
,
6
,
1
),(
null
,
8
,
1
),(
null
,
15
,
1
),(
null
,
20
,
1
);
select
last_insert_id
();
select
*
from
t2
;
drop
table
t2
;
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