• unknown's avatar
    Bug #27363: · e14fd2b6
    unknown authored
    Validity checks for nested set functions
    were not taking into account that the enclosed
    set function may be on a nest level that is
    lower than the nest level of the enclosing set
    function.
    Fixed by :
     - propagating max_sum_func_level
    up the enclosing set functions chain.
     - updating the max_sum_func_level of the 
       enclosing set function when the enclosed set
       function is aggregated above or on the same
       nest level of as the level of the enclosing 
       set function.
     - updating the max_arg_level of the enclosing
       set function on a reference that refers to
       an item above or on the same nest level
       as the level of the enclosing set function.
     - Treating both Item_field and Item_ref as possibly
       referencing items from outer nest levels.
    
    
    mysql-test/r/subselect.result:
      Bug #27363: test cases
    mysql-test/t/subselect.test:
      Bug #27363: test cases
    sql/item.cc:
      Bug #27363:
      Treat the reference as an outer reference for the
      enclosing set function even if it's referencing
      an item that is above the nest level of the
      enclosing set function.
      Consider both Item_field and Item_ref.
    sql/item_sum.cc:
      Bug #27363: Use the enclosed set function aggregation
      level to mark the enclosing set function even 
      if it's aggregated on a level that is above the 
      nest level of the enclosing set function.
      Pass max_sum_func_level up the accending branch of the
      recursion because it must take into account each
      directly or indirectly nested set function.
    e14fd2b6
bdb_notembedded.result 1.21 KB