• Sergei Petrunia's avatar
    MDEV-28602 Wrong result with outer join, merged derived table and view · b928c849
    Sergei Petrunia authored
    (Variant 3, initial variant was by Rex Jonston)
    
    A LEFT JOIN with a constant as a column of the inner table produced wrong
    query result if the optimizer had to write the inner table column into a
    temp table. Query pattern:
    
      SELECT ...
      FROM (SELECT /*non-mergeable select*/
            FROM t1 LEFT JOIN (SELECT 'Y' as Val) t2 ON ...) as tbl
    
    Fixed this by adding Item_direct_view_ref::save_in_field() which follows
    the pattern of Item_direct_view_ref's save_org_in_field(),
    save_in_result_field() and val_XXX() functions:
    * call check_null_ref() and handle NULL value
    * if we didn't get a NULL-complemented row, call Item_direct_ref's function.
    b928c849
join_outer_jcl6.result 102 KB