• Sergey Glukhov's avatar
    Bug#54494 crash with explain extended and prepared statements · 55390725
    Sergey Glukhov authored
    In case of outer join and emtpy WHERE conditon
    'always true' condition is created for WHERE clasue.
    Later in mysql_select() original SELECT_LEX WHERE
    condition is overwritten with created cond.
    However SELECT_LEX condition is also used as inital
    condition in mysql_select()->JOIN::prepare().
    On second execution of PS modified SELECT_LEX condition
    is taken and it leads to crash.
    The fix is to restore original SELECT_LEX condition
    (set to NULL if original cond is NULL) in
     reinit_stmt_before_use().
    HAVING clause is fixed too for safety reason
    (no test case as I did not manage to think out
     appropriate example).
    55390725
sql_prepare.cc 104 KB