List:Commits« Previous MessageNext Message »
From:Martin Skold Date:October 15 2009 8:28am
Subject:bzr commit into mysql-5.1-telco-6.3 branch (Martin.Skold:3106) Bug#47955
View as plain text  
#At file:///home/marty/MySQL/mysql-5.1-telco-6.3/

 3106 Martin Skold	2009-10-15
      Bug#47955 UPDATEs using indexes that modify no rows return incorrect found rows: don't use updated rows to set found number of rows, added test case
      modified:
        mysql-test/suite/ndb/r/ndb_update.result
        mysql-test/suite/ndb/t/ndb_update.test
        sql/sql_update.cc

=== modified file 'mysql-test/suite/ndb/r/ndb_update.result'
--- a/mysql-test/suite/ndb/r/ndb_update.result	2009-10-15 08:23:13 +0000
+++ b/mysql-test/suite/ndb/r/ndb_update.result	2009-10-15 08:28:50 +0000
@@ -27,6 +27,9 @@ pk1	b	c
 0	0	0
 2	2	2
 4	1	1
+UPDATE t1 set pk1 = 2 where pk1 = 2;
+affected rows: 0
+info: Rows matched: 1  Changed: 0  Warnings: 0
 UPDATE t1 set c = 1 WHERE b IN(0,1,2,3,4);
 ERROR 23000: Duplicate entry '1' for key 'c'
 UPDATE IGNORE t1 set c = 1 WHERE b IN(0,1,2,3,4);

=== modified file 'mysql-test/suite/ndb/t/ndb_update.test'
--- a/mysql-test/suite/ndb/t/ndb_update.test	2009-10-15 08:23:13 +0000
+++ b/mysql-test/suite/ndb/t/ndb_update.test	2009-10-15 08:28:50 +0000
@@ -28,6 +28,9 @@ select * from t1 order by pk1;
 UPDATE t1 set pk1 = 4 where pk1 = 2;
 UPDATE IGNORE t1 set pk1 = 4 where pk1 = 2;
 select * from t1 order by pk1;
+--enable_info
+UPDATE t1 set pk1 = 2 where pk1 = 2;
+--disable_info
 --error ER_DUP_ENTRY
 UPDATE t1 set c = 1 WHERE b IN(0,1,2,3,4);
 UPDATE IGNORE t1 set c = 1 WHERE b IN(0,1,2,3,4);

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2009-10-01 05:56:05 +0000
+++ b/sql/sql_update.cc	2009-10-15 08:28:50 +0000
@@ -857,13 +857,9 @@ int mysql_update(THD *thd,
       also when using BEFORE UPDATE triggers on table and also quite
       hard checks on UPDATE statement. Still it is used very often with
       all those limitations.
-
-      Moreover, since there is no read before update, found == updated,
-      as there is no optimization to remove the update if the new data
-      should equal the old.
     */
     table->file->info(HA_STATUS_WRITTEN_ROWS);
-    found= updated= table->file->stats.rows_updated;
+    updated= table->file->stats.rows_updated;
   }
 
   /* If LAST_INSERT_ID(X) was used, report X */

Thread
bzr commit into mysql-5.1-telco-6.3 branch (Martin.Skold:3106) Bug#47955Martin Skold15 Oct