• Sergey Glukhov's avatar
    Bug#54488 crash when using explain and prepared statements with subqueries · 233e4d80
    Sergey Glukhov authored
    The crash happens because original join table is replaced with temporary table
    at execution stage and later we attempt to use this temporary table in
    select_describe. It might happen that
    Item_subselect::update_used_tables() method which sets const_item flag
    is not called by some reasons (no where/having conditon in subquery for example).
    It prevents JOIN::join_tmp creation and breaks original join.
    The fix is to call ::update_used_tables() before ::const_item() check.
    
    
    mysql-test/r/ps.result:
      test case
    mysql-test/t/ps.test:
      test case
    sql/item_subselect.cc:
      call ::update_used_tables() before ::const_item() check.
    233e4d80
ps.test 82.7 KB