• unknown's avatar
    Bug #30788: Inconsistent retrieval of char/varchar · e9832cee
    unknown authored
    Index lookup does not always guarantee that we can
    simply remove the relevant conditions from the WHERE
    clause. Reasons can be e.g. conversion errors, 
    partial indexes etc. 
    The optimizer was removing these parts of the WHERE 
    condition without any further checking.
    This leads to "false positives" when using indexes.
    Fixed by checking the index reference conditions
    (using WHERE) when using indexes with sub-queries.
    
    
    mysql-test/r/subselect.result:
      Bug #30788: 
       - using where
       - test case
    mysql-test/r/subselect3.result:
      Bug #30788: using where
    mysql-test/t/subselect.test:
      Bug #30788: test case
    sql/item.h:
      Bug #30788: 
       - Declare eq() method of Item_cache descendants : this is used in
       test_if_ref()
       - preserve the field that is being cached for type comparisions
    sql/sql_select.cc:
      Bug #30788: Don't remove the WHERE when using index lookup 
      with subqueries.
    e9832cee
subselect.test 112 KB