• gshchepa/uchum@host.loc's avatar
    Fixed bug#36676: multiupdate using LEFT JOIN updates only · 2459d3a9
    gshchepa/uchum@host.loc 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.
    2459d3a9
sql_update.cc 52.5 KB