• unknown's avatar
    Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were · 5660bb85
    unknown authored
    touched but not actually changed.
    
    The LAST_INSERT_ID() is reset to 0 if no rows were inserted or changed.
    This is the case when an INSERT ... ON DUPLICATE KEY UPDATE updates a row
    with the same values as the row contains.
    
    Now the LAST_INSERT_ID() values is reset to 0 only if there were no rows
    successfully inserted or touched.
    The new 'touched' field is added to the COPY_INFO structure. It holds the
    number of rows that were touched no matter whether they were actually
    changed or not.
    
    
    sql/sql_class.h:
      Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
      touched but not actually changed.
      
      The new 'touched' field is added to the COPY_INFO structure. It holds the
      number of rows that were touched no matter whether they were actually
      changed or not.
    mysql-test/r/insert_update.result:
      Added a test case for the bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
      touched but not actually changed.
    mysql-test/t/insert_update.test:
      Added a test case for the bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
      touched but not actually changed.
    sql/sql_insert.cc:
      Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
      touched but not actually changed.
      
      Now the LAST_INSERT_ID() values is reset to 0 only if there were no rows
      successfully inserted or touched.
    5660bb85
sql_class.h 71.9 KB