• unknown's avatar
    Bug#20327: Marking of a wrong field leads to a wrong result on select with view, · fe499575
    unknown authored
    prepared statement and subquery.
    
    When a field of a view from an outer select is resolved the find_field_in_view
    function creates an Item_direct_view_ref object that references the 
    corresponding view underlying field. After that the view_ref is marked
    as a dependent one. While resolving view underlying field it also get
    marked as a dependent one due to current_select still points to the subselect.
    Marking the view underlying field is wrong and lead to attaching conditions
    to a wrong table and thus to the wrong result of the whole statement.
    
    Now mark_select_range_as_dependent() function isn't called for fields from a 
    view underlying table.
    
    
    sql/sql_base.cc:
      Bug#20327: Marking of a wrong field leads to a wrong result on select with view, prepared statement and subquery.
      
      Now mark_select_range_as_dependent() function isn't called for fields from a
      view underlying table.
    mysql-test/r/ps.result:
      Added a test case for bug#20327: Marking of a wrong field leads to a wrong result on select with view, prepared statement and subquery.
    mysql-test/t/ps.test:
      Added a test case for bug#20327: Marking of a wrong field leads to a wrong result on select with view,prepared statement and subquery.
    fe499575
sql_base.cc 167 KB