• unknown's avatar
    Fixed bug #28375: a query with an NOT IN subquery predicate may cause · 3d501aec
    unknown authored
    a crash when the left operand of the predicate is evaluated to NULL.
    It happens when the rows from the inner tables (tables from the subquery)
    are accessed by index methods with key values obtained by evaluation of
    the left operand of the subquery predicate. When this predicate is
    evaluated to NULL an alternative access with full table scan is used
    to check whether the result set returned by the subquery is empty or not.
    The crash was due to the fact the info about the access methods used for
    regular key values was not properly restored after a switch back from the
    full scan access method had occurred.
    The patch restores this info properly.
    The same problem existed for queries with IN subquery predicates if they
    were used not at the top level of the queries.
    
    
    mysql-test/r/subselect3.result:
      Added a test case for bug #28375.
    mysql-test/t/subselect3.test:
      Added a test case for bug #28375.
    sql/item_subselect.cc:
      Fixed bug #28375: a query with an NOT IN subquery predicate may cause
      a crash when the left operand of the predicate is evaluated to NULL.
      It happens when the rows from the inner tables (tables from the subquery)
      are accessed by index methods with key values obtained by evaluation of
      the left operand of the subquery predicate. When this predicate is
      evaluated to NULL an alternative access with full table scan is used
      to check whether the result set returned by the subquery is empty or not.
      The crash was due to the fact the info about the access methods used for
      regular key values was not properly restored after a switch back from the
      full scan access method had occurred.
      The patch restores this info properly.
    sql/sql_select.h:
      Fixed bug #28375: a query with an NOT IN subquery predicate may cause
      a crash when the left operand of the predicate is evaluated to NULL.
      In the JOIN_TAB structure two fields have been added to save info about
      index methods used to access the subquery rows. The saved info is used
      after a switch back from the alternative full scan access method has 
      occurred. The full scan is used when the left operand of the subquery
      predicate is evaluated to NULL.
    3d501aec
subselect3.test 15.9 KB