• Sergei Petrunia's avatar
    MDEV-23221: A subquery causes crash · b000d695
    Sergei Petrunia authored
    * Fix the crash: IN-to-EXISTS rewrite causes an error (and so
      JOIN::optimize() fails with an error, too), don't call
      update_used_tables(). Terminate the query execution instead.
    
    * Fix the cause of the error in the IN-to-EXISTS rewrite: don't do
      the rewrite if doing it will cause an error of this kind:
      This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left
      expression of IN/ALL/ANY'
    
    * Fix another issue exposed by this testcase:
      JOIN::setup_subquery_caches() may be invoked before any select has
      saved its query plan, and will crash because none of the SELECTs
      has called create_explain_query_if_not_exists() to create the Explain
      Data Structure for this SELECT.
    
    TODO: When merging this to 10.2, remove the poorly-placed call to
    create_explain_query_if_not_exists made by fix for M_D_E_V-16153
    b000d695
sql_select.cc 861 KB