• Gleb Shchepa's avatar
    Bug#40825: Error 1356 while selecting from a view · a7294532
    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.
    
    
    mysql-test/r/view.result:
      Added test file for bug #40825.
    mysql-test/t/view.test:
      Added test file for bug #40825.
    sql/item.cc:
      Bug#40825: Error 1356 while selecting from a view
                 with a "HAVING" clause though query works
      
      The Item_ref::print function has been modified
      to write correct aliased names of underlying
      items into VIEW definition generation/.frm file.
    a7294532
view.result 109 KB