Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-02-09 22:25:09+03:00, evgen@stripped +3 -0
Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were
inserted.
The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
no rows were inserted.
mysql-test/r/insert_select.result@stripped, 2007-02-09 22:24:54+03:00, evgen@stripped
+14 -0
Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT
when no rows were inserted.
mysql-test/t/insert_select.test@stripped, 2007-02-09 22:24:52+03:00, evgen@stripped
+13 -0
Added a test case for bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT
when no rows were inserted.
sql/sql_insert.cc@stripped, 2007-02-09 22:24:54+03:00, evgen@stripped +1 -1
Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT when no rows were
inserted.The select_insert::send_eof() function now resets LAST_INSERT_ID variable if
no rows were inserted.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /mnt/gentoo64/work/23170-bug-5.0-opt-mysql
--- 1.215/sql/sql_insert.cc 2007-02-07 00:44:35 +03:00
+++ 1.216/sql/sql_insert.cc 2007-02-09 22:24:54 +03:00
@@ -2630,7 +2630,7 @@
}
if (last_insert_id)
- thd->insert_id(last_insert_id); // For binary log
+ thd->insert_id(info.copied ? last_insert_id : 0); // For binary log
/* Write to binlog before commiting transaction */
if (mysql_bin_log.is_open())
{
--- 1.43/mysql-test/r/insert_select.result 2007-02-07 00:45:39 +03:00
+++ 1.44/mysql-test/r/insert_select.result 2007-02-09 22:24:54 +03:00
@@ -717,3 +717,17 @@
f1 f2
1 2
drop table t1;
+create table t1(f1 int primary key auto_increment, f2 int unique);
+insert into t1(f2) values(1);
+select @@identity;
+@@identity
+1
+insert ignore t1(f2) values(1);
+select @@identity;
+@@identity
+0
+insert ignore t1(f2) select 1;
+select @@identity;
+@@identity
+0
+drop table t1;
--- 1.35/mysql-test/t/insert_select.test 2007-02-07 00:45:19 +03:00
+++ 1.36/mysql-test/t/insert_select.test 2007-02-09 22:24:52 +03:00
@@ -279,3 +279,16 @@
--disable_info
select * from t1;
drop table t1;
+
+#
+# Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT if no rows
+# were inserted.
+#
+create table t1(f1 int primary key auto_increment, f2 int unique);
+insert into t1(f2) values(1);
+select @@identity;
+insert ignore t1(f2) values(1);
+select @@identity;
+insert ignore t1(f2) select 1;
+select @@identity;
+drop table t1;
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2408) BUG#23170 | eugene | 9 Feb |