List:Internals« Previous MessageNext Message »
From:eugene Date:June 15 2005 8:31pm
Subject:bk commit into 4.1 tree (evgen:1.2310) BUG#10886
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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.2310 05/06/15 22:31:54 evgen@stripped +3 -0
  Fix bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results
  
  Temporary field wasn't restored to default values after ON DUPLICATE KEY
  UPDATE event, which results in wrong data being inserted in new record.

  mysql-test/r/insert_select.result
    1.25 05/06/15 22:31:07 evgen@stripped +13 -0
    Fix bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results

  mysql-test/t/insert_select.test
    1.18 05/06/15 22:30:40 evgen@stripped +11 -0
    Fix bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results

  sql/sql_insert.cc
    1.165 05/06/15 22:29:54 evgen@stripped +1 -0
    Fix bug #10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results

# 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-4.1-bug-10886

--- 1.164/sql/sql_insert.cc	2005-06-02 05:44:52 +04:00
+++ 1.165/sql/sql_insert.cc	2005-06-15 22:29:54 +04:00
@@ -638,6 +638,7 @@
           goto err;
 	}
         info->updated++;
+        restore_record(table, default_values);
         break;
       }
       else /* DUP_REPLACE */

--- 1.24/mysql-test/r/insert_select.result	2005-03-31 05:32:40 +04:00
+++ 1.25/mysql-test/r/insert_select.result	2005-06-15 22:31:07 +04:00
@@ -625,3 +625,16 @@
 ID	NO	SEQ
 1	1	1
 drop table t1;
+drop table if exists t1, t2;
+Warnings:
+Note	1051	Unknown table 't1'
+Note	1051	Unknown table 't2'
+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.17/mysql-test/t/insert_select.test	2005-03-31 05:32:41 +04:00
+++ 1.18/mysql-test/t/insert_select.test	2005-06-15 22:30:40 +04:00
@@ -166,3 +166,14 @@
 select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
 drop table t1;
 
+#
+# Bug#10886 - INSERT ... SELECT ... ON DUPLICATE KEY UPDATE produces bad results
+#
+
+drop table if exists t1, t2;
+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 4.1 tree (evgen:1.2310) BUG#10886eugene15 Jun