• Gleb Shchepa's avatar
    Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY · c64d72f3
    Gleb Shchepa authored
    Select from a view with the underlying HAVING clause failed with a
    message: "1356: View '...' references invalid table(s) or column(s)
    or function(s) or definer/invoker of view lack rights to use them"
    
    The bug is a regression of the fix for bug 11750328 - 40825 (similar
    case, but the HAVING cause references an aliased field).
    In the old fix for bug 40825 the Item_field::name_length value has
    been used in place of the real length of Item_field::name. However,
    in some cases Item_field::name_length is not in sync with the
    actual name length (TODO: combine name and name_length into a
    solid String field).
    
    The Item_ref::print() method has been modified to calculate actual
    name length every time.
    
    
    mysql-test/r/view.result:
      Test case for bug #11829681
    mysql-test/t/view.test:
      Test case for bug #11829681
    sql/item.cc:
      Bug #11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
      
      The Item_ref::print() method has been modified to calculate actual
      name length every time.
    sql/item.h:
      Minor commentary.
    c64d72f3
view.result 117 KB