• Sergey Petrunya's avatar
    Apply Jorgen Loland's fix: Bug#45221: Query "SELECT pk FROM C WHERE pk IN (SELECT int_key)" failing · 5c836140
    Sergey Petrunya authored
    XOR conditions are not optimized, and Item_cond_xor therefore
    acts like type Func_item even though it inherits from Item_cond.
    A subtle difference between Item_func and Item_cond is that
    you can get the children Items from the former by calling
    arguments(), and from the latter by calling argument_list().
    However, since Item_cond_xor inherits from Item_cond,
    arguments() did not return any Items.
    
    The fact that Item_cond_xor::arguments() did not return it's
    children items lead to a problem for make_cond_for_index();
    the method accepted that XOR items on unindexed columns were
    pushed using ICP. ICP evaluation of non-indexed columns
    does not (and should not) work.
    
    The fix for this bug is to make Item_cond_xor return it's
    children items when the arguments() method is used. This makes
    Item_cond_xor behave more like Item_func and in turn allows
    make_cond_for_index() to discover any conflicting children
    Items.
    
    This is a temporary fix and should be removed when Item_cond_xor
     is optimized.
    5c836140
item_cmpfunc.h 53.3 KB