• evgen@moonbone.local's avatar
    Bug#16630: The update fields of the INSERT .. SELECT .. ON DUPLICATE KEY · 7916d9e9
    evgen@moonbone.local authored
    UPDATE contains wrong data if the SELECT employs a temporary table.
    
    If the UPDATE values of the INSERT .. SELECT .. ON DUPLICATE KEY UPDATE
    statement contains fields from the SELECT part and the select employs a
    temporary table then those fields will contain wrong values because they
    aren't corrected to get data from the temporary table.
    
    The solution is to add these fields to the selects all_fields list,
    to store pointers to those fields in the selects ref_pointer_array and
    to access them via Item_ref objects.
    
    The substitution for Item_ref objects is done in the new function called 
    Item_field::update_value_transformer(). It is called through the
    item->transform() mechanism at the end of the select_insert::prepare()
    function.
    7916d9e9
sql_insert.cc 92.5 KB