• unknown's avatar
    Fix bug lp:1002079 · 02bdc608
    unknown authored
      
      Analysis:
      The optimizer detects an empty result through constant table optimization.
      Then it calls return_zero_rows(), which in turns calls inderctly
      Item_maxmin_subselect::no_rows_in_result(). The latter method set "value=0",
      however "value" is pointer to Item_cache, and not just an integer value.
      
      All of the Item_[maxmin | singlerow]_subselect::val_XXX methods does:
        if (forced_const)
          return value->val_real();
      which of course crashes when value is a NULL pointer.
      
      Solution:
      When the optimizer discovers an empty result set, set
      Item_singlerow_subselect::value to a FALSE constant Item instead of NULL.
    02bdc608
subselect_no_opts.result 205 KB