• Sergey Petrunya's avatar
    BUG#882994: Crash in QUICK_RANGE_SELECT::reset with derived_with_keys · 57b3fefa
    Sergey Petrunya authored
    - The bug was caused by the following scenario:
      = a quick select is created with get_quick_select_for_ref. The quick 
        select refers to temporary (derived) table. It saves table->file, which
        refers to a ha_heap object.
      = When temp table is populated, ha_heap reaches max. size and is converted
        to a ha_myisam.  However, quick->file remains pointing to where ha_heap 
        was. 
      = Attempt to use the quick select causes crash.
    - Fixed by introducing QUICK_SELECT_I::replace_handler(). Note that it will 
      not work for index_merge quick selects. Which is fine, because these
      quick selects are never created for derived tables.
    57b3fefa
derived_view.test 35.7 KB