List:Internals« Previous MessageNext Message »
From:eugene Date:June 22 2005 7:07pm
Subject:bk commit into 5.0 tree (evgen:1.1988) BUG#10886
View as plain text  
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
  1.1988 05/06/22 21:07:28 evgen@stripped +3 -0
  Fix for bug #10886 merge

  sql/sql_insert.cc
    1.163 05/06/22 21:07:26 evgen@stripped +4 -16
    Fix for bug #10886 merge

  mysql-test/t/insert_select.test
    1.20 05/06/22 21:01:12 evgen@stripped +0 -0
    Auto merged

  mysql-test/r/insert_select.result
    1.28 05/06/22 21:01:12 evgen@stripped +0 -0
    Auto merged

# 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:	/work/mysql-5.0-bug-10886/RESYNC

--- 1.162/sql/sql_insert.cc	2005-06-22 13:11:19 +04:00
+++ 1.163/sql/sql_insert.cc	2005-06-22 21:07:26 +04:00
@@ -2119,9 +2119,12 @@
   }
   if (!(error= write_record(thd, table, &info)))
   {
-    if (table->triggers)
+    if (table->triggers || info.handle_duplicates == DUP_UPDATE)
     {
       /*
+        Restore fields of the record since it is possible that they were
+        changed by ON DUPLICATE KEY UPDATE clause.
+    
         If triggers exist then whey can modify some fields which were not
         originally touched by INSERT ... SELECT, so we have to restore
         their original values for the next row.

--- 1.27/mysql-test/r/insert_select.result	2005-04-02 07:17:13 +04:00
+++ 1.28/mysql-test/r/insert_select.result	2005-06-22 21:01:12 +04:00
@@ -625,3 +625,12 @@
 ID	NO	SEQ
 1	1	1
 drop table t1;
+create table t1 (f1 int);
+create table t2 (ff1 int unique, ff2 int default 1);
+insert into t1 values (1),(1),(2);
+insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;
+select * from t2;
+ff1	ff2
+1	2
+2	1
+drop table t1, t2;

--- 1.19/mysql-test/t/insert_select.test	2005-04-02 07:17:13 +04:00
+++ 1.20/mysql-test/t/insert_select.test	2005-06-22 21:01:12 +04:00
@@ -164,3 +164,12 @@
 select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
 drop table t1;
 
+#
+# Bug#10886 - Have to restore default values after update ON DUPLICATE KEY
+#
+create table t1 (f1 int);
+create table t2 (ff1 int unique, ff2 int default 1);
+insert into t1 values (1),(1),(2);
+insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;
+select * from t2;
+drop table t1, t2;
Thread
bk commit into 5.0 tree (evgen:1.1988) BUG#10886eugene22 Jun