• Gleb Shchepa's avatar
    Bug#40825: Error 1356 while selecting from a view · 8a39147a
    Gleb Shchepa authored
               with a "HAVING" clause though query works
    
    SELECT from views defined like:
    
      CREATE VIEW v1 (view_column)
        AS SELECT c AS alias FROM t1 HAVING alias
    
    fails with an error 1356:
      View '...' references invalid table(s) or column(s)
      or function(s) or definer/invoker of view lack rights
      to use them
    
    
    CREATE VIEW form with a (column list) substitutes
    SELECT column names/aliases with names from a
    view column list.
    However, alias references in HAVING clause was
    not substituted.
    
    
    The Item_ref::print function has been modified
    to write correct aliased names of underlying
    items into VIEW definition generation/.frm file.
    8a39147a
view.result 109 KB