• unknown's avatar
    Fixed bug #28728: a crash when executing EXPLAIN EXTENDED for a query · 8c4ff24b
    unknown authored
    using a derived table over a grouping subselect.
    
    This crash happens only when materialization of the derived tables 
    requires creation of auxiliary temporary table, for example when
    a grouping operation is carried out with usage of a temporary table.
    
    The crash happened because EXPLAIN EXTENDED when printing the query
    expression made an attempt to use the objects created in the mem_root
    of the temporary table which has been already freed by the moment
    when printing is called.
    
    This bug appeared after the method Item_field::print() had been 
    introduced.    
    
    
    mysql-test/r/subselect.result:
      Added a test case for bug #28728.
    mysql-test/t/subselect.test:
      Added a test case for bug #28728.
    sql/sql_select.cc:
      Fixed bug #28728: a crash when executing EXPLAIN EXTENDED for a query
      using a derived table over a grouping subselect.
      The crash happened because EXPLAIN EXTENDED when printing the query
      expression made an attempt to use the objects created in the mem_root
      of the temporary table which has been already freed by the moment
      when printing is accomplished.
      The fix in JOIN::exec() ensures using existing objects when printing 
      subselects for a derived tables by EXPLAIN EXTENDED.
    8c4ff24b
sql_select.cc 488 KB