• Jon Olav Hauglid's avatar
    Bug #47919 assert in open_table during ALTER temporary table · 63541129
    Jon Olav Hauglid authored
    This assertion would occur if UPDATE was used to update multiple
    tables containing an AUTO_INCREMENT column and if the inserted
    row had a user-supplied value for that column. The assertion 
    could then be triggered by the next statement.
    
    The problem was only noticeable on debug builds of the server.
    
    The cause of the problem was that the code for multi update did
    not properly reset the TABLE->auto_increment_if_null flag after update.
    The flag is used to indicate that a non-null value of an auto_increment field
    has been provided by the user or retrieved from a current record.
    Open_tables() contains an assertion that tests this flag, and this
    was triggered in this case by ALTER TABLE.
    
    This patch fixes the problem by resetting the auto_increment_if_null
    field to FALSE once a row has been updated.
    
    This bug is similar to Bug#47274, but for multi update rather
    than INSERT DELAYED.
    
    Test case added to update.test.
    63541129
update.test 13.2 KB