• Rex's avatar
    MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash · c6a9fd79
    Rex authored
    Statements affected by this bug are delete statements that have all
    these conditions
    
    1) single table delete syntax
    2) and in (sub-query) predicate
    3) semi-join optimization enabled
    4) an order by clause.
    
    Semijoin optimization on an innocent looking query, such as
    
    DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
    
    turns it from a single table delete to a multi-table delete.
    
    During multi_delete::initialize_tables for the top level join object, a
    table is initialized missing a keep_current_rowid flag, needed to
    position a handler for removal of the correct row after the filesort
    structure has been built.
    
    Fix provided by Monty (monty@mariadb.com)
    Pushed into 10.5 at Monty's request.
    Applicable to 10.6, 10.11, 11.0.
    OK'd by Monty in slack:#askmonty 2023-12-01
    c6a9fd79
filesort.h 6.67 KB