Skip to content
  • Annamalai Gurusami's avatar
    869c1325
    Bug #14483484 INSERT ... ON DUPLICATE KEY UPDATE + INNODB_AUTOINC_LOCK_MODE=1 · 869c1325
    Annamalai Gurusami authored
    IS BROKEN
    
    Problem:
    
    When a multi-row INSERT ... ON DUPLICATE KEY UPDATE statement begins
    execution it reserves the required number of auto increment values.
    When one of the insert fails because of duplicate key error, then it
    will become an update operation.  The auto increment value of this
    update operation will determine the auto increment values
    used for subsequent inserts.  This can result in duplicate auto increment
    values.
    
    Solution:
    
    When an insert operation of a multi-row INSERT ... ON DUPLICATE KEY 
    UPDATE statement fails, check if the update clause explicitly updates
    the auto increment value. If an explicit value is given for an 
    auto increment field, then check if it will conflict with the values
    that we have reserved.  If it might conflict then return an error.  
    Also, the update clause will not bump the auto increment value for
    the rows inserted in the multi-row INSERT ... ON DUPLICATE KEY.
    
    rb#2219 approved by Guilhem and Dmitry Shulga.
    
    869c1325
    Bug #14483484 INSERT ... ON DUPLICATE KEY UPDATE + INNODB_AUTOINC_LOCK_MODE=1
    Annamalai Gurusami authored
    IS BROKEN
    
    Problem:
    
    When a multi-row INSERT ... ON DUPLICATE KEY UPDATE statement begins
    execution it reserves the required number of auto increment values.
    When one of the insert fails because of duplicate key error, then it
    will become an update operation.  The auto increment value of this
    update operation will determine the auto increment values
    used for subsequent inserts.  This can result in duplicate auto increment
    values.
    
    Solution:
    
    When an insert operation of a multi-row INSERT ... ON DUPLICATE KEY 
    UPDATE statement fails, check if the update clause explicitly updates
    the auto increment value. If an explicit value is given for an 
    auto increment field, then check if it will conflict with the values
    that we have reserved.  If it might conflict then return an error.  
    Also, the update clause will not bump the auto increment value for
    the rows inserted in the multi-row INSERT ... ON DUPLICATE KEY.
    
    rb#2219 approved by Guilhem and Dmitry Shulga.
    
Loading