• Igor Babaev's avatar
    MDEV-28617 Crash with INSERT...SELECT using derived table in GROUP BY clause · c2300d06
    Igor Babaev authored
    This bug manifested itself for INSERT...SELECT and DELETE statements whose
    WHERE condition used an IN/ANY/ALL predicand or a EXISTS predicate with
    such grouping subquery that:
     - its GROUP BY clause could be eliminated,
     - the GROUP clause contained a subquery over a mergeable derived table
       referencing the updated table.
    
    The bug ultimately caused a server crash when the prepare phase of the
    statement processing was executed. This happened after removal redundant
    subqueries used in the eliminated GROUP BY clause from the statement tree.
    The function that excluded the subqueries from the did not do it properly.
    As a result the specification of any derived table contained in a removed
    subquery was not marked as excluded.
    
    Approved by Oleksandr Byelkin <sanja@mariadb.com>
    c2300d06
sql_lex.cc 249 KB