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.2475 05/12/01 23:22:20 evgen@stripped +3 -0
Fix bug#15028 Multitable update returns different numbers of matched rows
depending on table order
multi_update::send_data() was counting updates, not updated rows. Thus if one
record have several updates it will be counted several times in 'rows matched'
but updated only once.
multi_update::send_data() now counts only unique rows.
mysql-test/r/update.result
1.28 05/12/01 23:20:44 evgen@stripped +13 -0
Test case for bug#15028 Multitable update returns different numbers of matched rows
depending on table order
mysql-test/t/update.test
1.26 05/12/01 23:20:10 evgen@stripped +17 -0
Test case for bug#15028 Multitable update returns different numbers of matched rows
depending on table order
sql/sql_update.cc
1.148 05/12/01 23:19:06 evgen@stripped +7 -6
Fix bug#15028 Multitable update returns different numbers of matched rows
depending on table order
multi_update::send_data() now counts only unique rows.
# 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/15028-bug-4.1-mysql
--- 1.147/sql/sql_update.cc 2005-10-28 01:23:05 +04:00
+++ 1.148/sql/sql_update.cc 2005-12-01 23:19:06 +03:00
@@ -1082,22 +1082,23 @@
int error;
TABLE *tmp_table= tmp_tables[offset];
fill_record(tmp_table->field+1, *values_for_table[offset], 1);
- found++;
/* Store pointer to row */
memcpy((char*) tmp_table->field[0]->ptr,
(char*) table->file->ref, table->file->ref_length);
/* Write row, ignoring duplicated updates to a row */
- if ((error= tmp_table->file->write_row(tmp_table->record[0])) &&
- (error != HA_ERR_FOUND_DUPP_KEY &&
- error != HA_ERR_FOUND_DUPP_UNIQUE))
+ if (error= tmp_table->file->write_row(tmp_table->record[0]))
{
- if (create_myisam_from_heap(thd, tmp_table, tmp_table_param + offset,
- error, 1))
+ if (error != HA_ERR_FOUND_DUPP_KEY &&
+ error != HA_ERR_FOUND_DUPP_UNIQUE &&
+ create_myisam_from_heap(thd, tmp_table,
+ tmp_table_param + offset, error, 1))
{
do_update=0;
DBUG_RETURN(1); // Not a table_is_full error
}
}
+ else
+ found++;
}
}
DBUG_RETURN(0);
--- 1.27/mysql-test/r/update.result 2005-10-28 01:17:34 +04:00
+++ 1.28/mysql-test/r/update.result 2005-12-01 23:20:44 +03:00
@@ -345,3 +345,16 @@
2000-01-01
2002-02-02
drop table t1;
+create table t1 (f1 int);
+create table t2 (f2 int);
+insert into t1 values(1),(2);
+insert into t2 values(1),(1);
+update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
+affected rows: 3
+info: Rows matched: 3 Changed: 3 Warnings: 0
+update t2 set f2=1;
+update t1 set f1=1 where f1=3;
+update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
+affected rows: 3
+info: Rows matched: 3 Changed: 3 Warnings: 0
+drop table t1,t2;
--- 1.25/mysql-test/t/update.test 2005-10-28 01:19:13 +04:00
+++ 1.26/mysql-test/t/update.test 2005-12-01 23:20:10 +03:00
@@ -270,4 +270,21 @@
update t1 set f1='2002-02-02' where f1 is null;
select * from t1;
drop table t1;
+
+#
+# Bug#15028 Multitable update returns different numbers of matched rows
+# depending on table order
+create table t1 (f1 int);
+create table t2 (f2 int);
+insert into t1 values(1),(2);
+insert into t2 values(1),(1);
+--enable_info
+update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
+--disable_info
+update t2 set f2=1;
+update t1 set f1=1 where f1=3;
+--enable_info
+update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
+--disable_info
+drop table t1,t2;
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (evgen:1.2475) BUG#15028 | eugene | 1 Dec |