• Oystein Grovlen's avatar
    Bug#57704 Cleanup code dies with void TABLE::set_keyread(bool): Assertion `file' failed. · bb356127
    Oystein Grovlen authored
    This bug was introduced in this revision: 
    kostja@sun.com-20100727102553-b4n2ojcyfj79l2x7
    ("A pre-requisite patch for the fix for Bug#52044.")
    
    It happens because close_thread_tables() is now called in
    open_and_lock_tables upon failure.  Hence, table is no longer
    open when optimizer tries to do cleanup.
    
    Fix: Make sure to do cleanup in st_select_lex_unit::prepare()
    upon failure. This way, cleanup() is called before tables are
    released.
    
    mysql-test/r/subselect.result:
      Added test case for Bug#57704.
    mysql-test/t/subselect.test:
      Added test case for Bug#57704.
    sql/sql_union.cc:
      st_select_lex_unit::prepare():  On failure, make sure cleanup()
      is called.
    bb356127
subselect.test 136 KB