• unknown's avatar
    BUG#24127: (a,b) IN (SELECT c,d ...) can produce wrong results if a and/or b are NULLs: · 5f97dc6e
    unknown authored
    - Make the code produce correct result: use an array of triggers to turn on/off equalities for each
      compared column. Also turn on/off optimizations based on those equalities.
    - Make EXPLAIN output show "Full scan on NULL key" for tables for which we switch between
      ref/unique_subquery/index_subquery and ALL access.
    - index_subquery engine now has HAVING clause when it is needed, and it is
      displayed in EXPLAIN EXTENDED
    - Fix incorrect presense of "Using index" for index/unique-based subqueries (BUG#22930)
    // bk trigger note: this commit refers to BUG#24127
    
    
    mysql-test/r/ndb_subquery.result:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Updated test results (checked)
    mysql-test/r/subselect.result:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Updated test results (checked)
    mysql-test/r/subselect2.result:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Updated test results (checked)
    mysql-test/r/subselect3.result:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Testcases
    mysql-test/t/subselect3.test:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Testcases
    sql/item_cmpfunc.cc:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - For row-based IN subqueries, use one flag per each column. Set the flags appropriately before
        running the subquery.
    sql/item_cmpfunc.h:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
       - Added Item_func_trig_cond::get_triv_var()
    sql/item_subselect.cc:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Item_subselect::exec() and subselect_*_engine::exec() don't have parameter
        anymore - now Item_subselect owns the pushed down predicates guard flags.
      - A correct set of conditional predicates is now pushed into row-based IN 
        subquery.
      - select_indexsubquery_engine now has "HAVING clause" (needed for correct query
        results), and it is shown in EXPLAIN EXTENDED
    sql/item_subselect.h:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Item_subselect::exec() and subselect_*_engine::exec() don't have parameter
        anymore - now Item_subselect owns the pushed down predicates guard flags.
      - A correct set of conditional predicates is now pushed into row-based IN 
        subquery.
      - select_indexsubquery_engine now has "HAVING clause" (needed for correct query
        results), and it is shown in EXPLAIN EXTENDED
    sql/mysql_priv.h:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Added "in_having_cond" special Item name
    sql/mysqld.cc:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Added "in_having_cond" special Item name
    sql/sql_lex.h:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
    sql/sql_select.cc:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Make "ref" analyzer be able to work with conditional equalities
      - Fix subquery optimization code to match the changes in what kinds of 
        conditions are pushed down into subqueries 
      - Fix wrong EXPLAIN output in some queries with subquery (BUG#22390)
    sql/sql_select.h:
      BUG#24127: wrong result for (null,not-null) IN (SELECT a,b ...)
      - Make "ref" analyzer be able to work with conditional equalities
      - Fix wrong EXPLAIN output in some queries with subquery (BUG#22390)
    5f97dc6e
item_cmpfunc.h 42.6 KB