• unknown's avatar
    Fixed bug#36676: multiupdate using LEFT JOIN updates only · 29e7fa25
    unknown authored
                     first row or fails with an error:
      ERROR 1022 (23000): Can't write; duplicate key in table ''
    
    The server uses intermediate temporary table to store updated
    row data.  The first column of this table contains rowid.
    Current server implementation doesn't reset NULL flag of that
    column even if the server fills a column with rowid.
    To keep each rowid unique, there is an unique index.
    An insertion into an unique index takes into account NULL
    flag of key value and ignores real data if NULL flag is set.
    So, insertion of actually different rowids may lead to two
    kind of problems.  Visible effect of each of these problems
    depends on an initial engine type of temporary table:
    
    1. If multiupdate initially creates temporary table as
    a MyISAM table (a table contains blob columns, and the
    create_tmp_table function assumes, that this table is
    large), it inserts only one single row and updates
    only rows with one corresponding rowid. Other rows are
    silently ignored. 
    
    2. If multiupdate initially creates MEMORY temporary
    table, fills it with data and reaches size limit for
    MEMORY tables (max_heap_table_size), multiupdate
    converts MEMORY table into MyISAM table and fails
    with an error:
      ERROR 1022 (23000): Can't write; duplicate key in table ''
    
    
    Multiupdate has been fixed to update the NULL flag of
    temporary table rowid columns.
    
    
    
    mysql-test/r/multi_update_tiny_hash.result:
      Added test case for bug#36676.
    mysql-test/t/multi_update_tiny_hash-master.opt:
      Added test case for bug#36676.
    mysql-test/t/multi_update_tiny_hash.test:
      Added test case for bug#36676.
    sql/sql_update.cc:
      Fixed bug#36676: multiupdate using LEFT JOIN updates only
                       first row or fails with an error:
        ERROR 1022 (23000): Can't write; duplicate key in table ''
      
      The multi_update::send_data method has been modified to reset null bits of
      fields containing rowids.
    29e7fa25
multi_update_tiny_hash-master.opt 41 Bytes