• gshchepa/uchum@gshchepa.loc's avatar
    Fixed bug #27650: · 5983038a
    gshchepa/uchum@gshchepa.loc authored
    INSERT into InnoDB table may cause "ERROR 1062 (23000): Duplicate entry..."
    errors or lost records after multi-row INSERT of the form:
    "INSERT INTO t (id...) VALUES (NULL...) ON DUPLICATE KEY UPDATE id=VALUES(id)",
    where "id" is an AUTO_INCREMENT column.
    
    It happens because InnoDB handler forgets to save next insert id after
    updating of auto_increment column with new values. As result of that
    last insert id stored inside InnoDB dictionary tables differs from it's
    cached thd->next_insert_id value.
    5983038a
ha_innodb.cc 214 KB