• Igor Babaev's avatar
    Fixed LP bugs #717577, #724942. · 1a18998c
    Igor Babaev authored
    Both these two bugs happened due to the following problem.
    When a view column is referenced in the query an Item_direct_view_ref
    object is created that is refers to the Item_field for the column.
    All references to the same view column refer to the same Item_field.
    Different references can belong to different AND/OR levels and,
    as a result, can be included in different Item_equal object.
    These Item_equal objects may include different constant objects.
    If these constant objects are substituted for the Item_field created
    for a view column we have a conflict situation when the second
    substitution annuls the first substitution. This leads to
    wrong result sets returned by the query. Bug #724942 demonstrates
    such an erroneous behaviour.
    Test case of the bug #717577 produces wrong result sets because best
    equal fields of the multiple equalities built for different OR levels
    of the WHERE condition differs. The subsitution for the best equal field
    in the second OR branch overwrites the the substitution made for the
    first branch.
    
    To avoid such conflicts we have to substitute for the references
    to the view columns rather than for the underlying field items.
    To make such substitutions possible we have to include into
    multiple equalities references to view columns rather than 
    field items created for such columns.
    
    This patch modifies the Item_equal class to include references
    to view columns into multiple equality objects. It also performs
    a clean up of the class methods and adds more comments. The methods
    of the Item_direct_view_ref class that assist substitutions for
    references to view columns has been also added by this patch.
    1a18998c
item.cc 236 KB