• Gleb Shchepa's avatar
    backport from mysql-trunk · 69505e51
    Gleb Shchepa authored
    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.
    
    
    sql/sql_insert.cc:
      write_record() function:
      Unneeded increment of "touched" rows and useless double resetting
      of auto-increment value has been removed.
    tests/mysql_client_test.c:
      New test case.
    69505e51
sql_insert.cc 135 KB