diff options
author | evgen@moonbone.local <> | 2005-12-01 23:22:20 +0300 |
---|---|---|
committer | evgen@moonbone.local <> | 2005-12-01 23:22:20 +0300 |
commit | 3f72e7645f93454ed34cbd8b0ca9cdbae05a59d0 (patch) | |
tree | 3c4c81ee2c0591a8486928fe1acc499756cec8e9 /sql | |
parent | f57dffe4539bde8a4c4494fdb4e09af6ca7c83ae (diff) | |
download | mariadb-git-3f72e7645f93454ed34cbd8b0ca9cdbae05a59d0.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_update.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index cb8064bef87..05e13c64aa7 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1082,22 +1082,23 @@ bool multi_update::send_data(List<Item> ¬_used_values) 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); |