• unknown's avatar
    Fix bug#11868 NOT NULL ref optimization in subquery used in update must be · eb944444
    unknown authored
    disabled if ref is built with a key from the updated table
    
    Problem was in add_not_null_conds() optimization function.
    It contains following code:
    JOIN_TAB *referred_tab= not_null_item->field->table->reginfo.join_tab;
    ...
    add_cond_and_fix(&referred_tab->select_cond, notnull);
    For UPDATE described in bug report referred_tab is 0 and dereferencing it
    crashes the server.
    
    
    
    sql/sql_select.cc:
      Fix bug #11868 NOT NULL ref optimization in subquery used in update must be
      disabled if ref is built with a key from the updated table
    mysql-test/r/update.result:
      Test case for bug#11868 Update with subquery with ref built with a key from
      the updated table crashes server.
    mysql-test/t/update.test:
      Test case for bug#11868 Update with subquery with ref built with a key from the updated table crashes server
    eb944444
update.test 6.93 KB