• unknown's avatar
    Fix LP BUG#611622 · 970b46b1
    unknown authored
    Fix MySQL BUG#52344 - Subquery materialization: Assertion if subquery in on-clause of outer join
    
    Original fix and comments from Oysten, adjusted for the different
    subquery optimization in MariaDB.
    "
    Problem: If tables of an outer join are constant tables,
    the associated on-clause will be evaluated in the optimization
    phase. If the on-clause contains a query that is to be
    executed with subquery materialization, this will not work
    since the infrastructure for such execution is not yet set up.
          
    Solution: Do not evaluate on-clause in optimization phase if
    is_expensive() returns true for this clause.  This is how the
    problem is currently avoided for where-clauses.  This works
    because, Item_in_subselect::is_expensive_processor returns true
    if query is to be executed with subquery materialization.
    "
    In addition, after MWL#89, in MariaDB if the IN-EXISTS strategy
    is chosen, the in-to-exists predicates are insterted after
    join_read_const_table() is called, resulting in evaluation of
    the subquery without the in-to-exists predicates.
    970b46b1
subselect_mat.result 87.3 KB