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
fc8366e0
Commit
fc8366e0
authored
Mar 16, 2007
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge moonbone.local:/mnt/gentoo64/work/27033-bug-5.0-opt-mysql
into moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
parents
6640efd5
3d0df38f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
mysql-test/r/insert_update.result
mysql-test/r/insert_update.result
+11
-0
mysql-test/t/insert_update.test
mysql-test/t/insert_update.test
+12
-0
No files found.
mysql-test/r/insert_update.result
View file @
fc8366e0
...
...
@@ -236,3 +236,14 @@ INSERT INTO t2 VALUES (1), (3);
INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
ERROR 42S22: Unknown column 'a' in 'field list'
DROP TABLE t1,t2;
CREATE TABLE t1 (f1 INT AUTO_INCREMENT PRIMARY KEY,
f2 VARCHAR(5) NOT NULL UNIQUE);
INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
DROP TABLE t1;
mysql-test/t/insert_update.test
View file @
fc8366e0
...
...
@@ -162,3 +162,15 @@ INSERT INTO t2 VALUES (1), (3);
--
error
ER_BAD_FIELD_ERROR
INSERT
INTO
t1
SELECT
1
,
COUNT
(
*
)
FROM
t2
ON
DUPLICATE
KEY
UPDATE
j
=
a
;
DROP
TABLE
t1
,
t2
;
#
# Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
# touched but not actually changed.
#
CREATE
TABLE
t1
(
f1
INT
AUTO_INCREMENT
PRIMARY
KEY
,
f2
VARCHAR
(
5
)
NOT
NULL
UNIQUE
);
INSERT
t1
(
f2
)
VALUES
(
'test'
)
ON
DUPLICATE
KEY
UPDATE
f1
=
LAST_INSERT_ID
(
f1
);
SELECT
LAST_INSERT_ID
();
INSERT
t1
(
f2
)
VALUES
(
'test'
)
ON
DUPLICATE
KEY
UPDATE
f1
=
LAST_INSERT_ID
(
f1
);
SELECT
LAST_INSERT_ID
();
DROP
TABLE
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