• Igor Babaev's avatar
    MDEV-31181 Crash with EXPLAIN EXTENDED for single-table DELETE using IN predicand · a09f661f
    Igor Babaev authored
    This bug affected EXPLAIN EXTENDED command for single-table DELETE that
    used an IN subquery in its WHERE clause. A crash happened if the optimizer
    chose to employ index_subquery or unique_subquery access when processing
    such command.
    The crash happened when the command tried to print the transformed query.
    In the current code of 10.4 for single-table DELETE statements the output
    of any explain command is produced after the join structures of all used
    subqueries have been destroyed. JOIN::destroy() sets the field tab of the
    JOIN_TAB structures created for subquery tables to NULL. As a result
    subselect_indexsubquery_engine::print(), subselect_indexsubquery_engine()
    cannot use this field to get the alias name of the joined table.
    
    This patch suggests to use the field TABLE_LIST::TAB that can be accessed
    from JOIN_TAB::tab_list to get the alias name of the joined table.
    
    Approved by Oleksandr Byelkin <sanja@mariadb.com>
    a09f661f
opt_subselect.cc 240 KB