• unknown's avatar
    Fixed bug #25580: incorrect stored representations of views in cases · af321686
    unknown authored
    when they contain the '!' operator.
    Added an implementation for the method Item_func_not::print. 
    The method encloses any NOT expression into extra parentheses to avoid
    incorrect stored representations of views that use the '!' operators.
    Without this change when a view was created that contained
    the expression !0*5  its stored representation contained not this
    expression but rather the expression not(0)*5 . 
    The operator '!' is of a higher precedence than '*', while NOT is 
    of a lower precedence than '*'. That's why the expression !0*5 
    is interpreted as not(0)*5, while the expression not(0)*5 is interpreted
    as not((0)*5) unless sql_mode is set to HIGH_NOT_PRECEDENCE.
    Now we translate !0*5 into (not(0))*5. 
    
    
    mysql-test/r/sp-code.result:
      Adjusted results after the fix of bug 25580.
    mysql-test/r/subselect.result:
      Adjusted results after the fix of bug 25580.
    mysql-test/r/view.result:
      Added a test case for bug #25580.
    mysql-test/t/view.test:
      Added a test case for bug #25580.
    sql/item_cmpfunc.cc:
      Fixed bug #25580: incorrect stored representations of views in cases
      when they contain the '!' operator.
      Added an implementation for the method Item_func_not::print. 
      The method encloses the NOT expression into extra parenthesis to avoid
      incorrect stored representations of views that use the '!' operators.
    sql/item_cmpfunc.h:
      Fixed bug #25580: incorrect stored representations of views in cases
      when they contain the '!' operator.
      Added an implementation for the method Item_func_not::print. 
      The method encloses the NOT expression into extra parenthesis to avoid
      incorrect stored representations of views that use the '!' operators.
    af321686
view.result 89.2 KB