• unknown's avatar
    Fix for BUG#32694 "NOT NULL table field in a subquery produces invalid results" · b5640b1f
    unknown authored
      
    The problem was that when convert_constant_item is called for subqueries,
    this happens when we already started executing the top-level query, and
    the field argument of convert_constant_item pointed to a valid table row.
    In turn convert_constant_item used the field buffer to compute the value
    of its item argument. This copied the item's value into the field,
    and made equalities with outer references always true.
      
    The fix saves/restores the original field's value when it belongs to an
    outer table.
    
    
    mysql-test/r/type_datetime.result:
      Test for BUG#32694.
    mysql-test/t/type_datetime.test:
      Test for BUG#32694.
    sql/item_cmpfunc.cc:
      - Changed convert_constant_item() so that it doesn't destroy the contents
        of its field argument when the field originates from table in an outer
        query.
    b5640b1f
item_cmpfunc.cc 127 KB