diff options
author | Gleb Shchepa <gleb.shchepa@oracle.com> | 2011-08-03 17:53:44 +0400 |
---|---|---|
committer | Gleb Shchepa <gleb.shchepa@oracle.com> | 2011-08-03 17:53:44 +0400 |
commit | 1392945b60a0ad4772318cc3e0566cc545a14c25 (patch) | |
tree | 42b4e9ef7fcad13909cbd4b22088acfc8baf2f6b /sql/sql_insert.cc | |
parent | 6ac689fb4a2aed43080b94d5c6610b1e63663e03 (diff) | |
download | mariadb-git-1392945b60a0ad4772318cc3e0566cc545a14c25.tar.gz |
backport from mysql-trunk
BUG #11754979 - 46675: ON DUPLICATE KEY UPDATE AND UPDATECOUNT() POSSIBLY WRONG
The mysql_affected_rows() client call returns 3 instead of 2 on
INSERT ... ON DUPLICATE KEY UPDATE query with a duplicated key value.
The fix for the old bug #29692 was incomplete: unnecessary double
increment of "touched" rows still happened.
This bugfix removes:
1) unneeded increment of "touched" rows and
2) useless double resetting of auto-increment value.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 5dc2a7e2abb..eaf7f4c895b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1610,9 +1610,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) goto before_trg_err; table->file->restore_auto_increment(prev_insert_id); - if (table->next_number_field) - table->file->adjust_next_insert_id_after_explicit_value( - table->next_number_field->val_int()); info->touched++; if (!records_are_comparable(table) || compare_records(table)) { @@ -1649,8 +1646,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) if (table->next_number_field) table->file->adjust_next_insert_id_after_explicit_value( table->next_number_field->val_int()); - info->touched++; - goto ok_or_after_trg_err; } else /* DUP_REPLACE */ |