• Igor Babaev's avatar
    MDEV-17360 Server crashes in optimize_keyuse · d03581bf
    Igor Babaev authored
    This was a bug in the code of MDEV-12387 "Push conditions into materialized
    subqueries". The bug manifested itself in rather rare situations. An
    affected query must contain IN subquery predicate whose left operand
    was an outer field of a mergeable derived table or view and right operand
    was a materialized subquery.
    The erroneous code in fact stripped off the Item_direct_ref wrapper from
    the left operand of the IN subquery predicate when building equalities
    produced by the conversion of the predicate into a semi-join. As a result
    the left operand was not considered as an outer reference anymore and
    used_tables() was calculated incorrectly. This caused a crash in the
    function optimize_keyuse().
    d03581bf
opt_subselect.cc 227 KB