• Alexander Barkov's avatar
    MDEV-8740 Wrong result for SELECT..WHERE year_field=10 AND NULLIF(year_field,2011.1)='2011' · 4aebba3a
    Alexander Barkov authored
    MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020'
    Problems:
    1. Item_func_nullif stored a copy of args[0] in a private member m_args0_copy,
       which was invisible for the inherited Item_func menthods, like
       update_used_tables(). As a result, after equal field propagation
       things like Item_func_nullif::const_item() could return wrong result
       and a non-constant NULLIF() was erroneously treated as a constant
       at optimize_cond() time.
       Solution: removing m_args0_copy and storing the return value item
       in args[2] instead.
    2. Equal field propagation did not work well for Item_fun_nullif.
       Solution: using ANY_SUBST for args[0] and args[1], as they are in
       comparison, and IDENTITY_SUBST for args[2], as it's not in comparison.
    4aebba3a
null.test 25.8 KB