• unknown's avatar
    BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...) · b671815c
    unknown authored
    When transforming "oe IN (SELECT ie ...)" wrap the pushed-down predicates
    iff "oe can be null", not "ie can be null".
    The fix doesn't cover row-based subqueries, those will be fixed in #24127.
    
    
    mysql-test/r/subselect.result:
      BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
      Update the test results (checked)
    mysql-test/r/subselect3.result:
      BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
      - Testcase
    mysql-test/t/subselect3.test:
      BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
      - Testcase
    sql/item_subselect.cc:
      BUG#24085: Wrong result for NULL IN (SELECT not_null_val FROM ...)
      When transforming "oe IN (SELECT ie ...)" we should make special 
      provisions (wrap the pushed predicates) if we can encounter 
      NULL IN (SELECT ...), i.e. when oe->maybe_null. The code was checking
      for ie->maybe_null instead, fixed it for single value based subqueries.
      
      Row-based subqueries (e.g. (a,b) IN (SELECT c,d ...)) are not fixed 
      because they won't produce correct results for several other reasons 
      (filed as #24085)
    b671815c
subselect.result 131 KB