diff options
-rw-r--r-- | mysql-test/include/icp_tests.inc | 20 | ||||
-rw-r--r-- | mysql-test/r/innodb_icp.result | 15 | ||||
-rw-r--r-- | mysql-test/r/maria_icp.result | 15 | ||||
-rw-r--r-- | mysql-test/r/myisam_icp.result | 15 | ||||
-rw-r--r-- | sql/sql_select.cc | 3 |
5 files changed, 67 insertions, 1 deletions
diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc index 3a278d5f10c..ea4fc6439d2 100644 --- a/mysql-test/include/icp_tests.inc +++ b/mysql-test/include/icp_tests.inc @@ -724,3 +724,23 @@ SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0 HAVING t1.c != 5 ORDER BY t1.c; DROP TABLE t1,t2; + +--echo # +--echo # Bug#879871: InnoDB: possible ICP + GROUP BY primary index +--echo # + +CREATE TABLE t1 ( + a int NOT NULL, b int, c varchar(1), d varchar(1), + PRIMARY KEY (a), KEY c (c,b) +); +INSERT INTO t1 VALUES (10,8,'g','g'); + +SET SESSION optimizer_switch='index_condition_pushdown=off'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; + +SET SESSION optimizer_switch='index_condition_pushdown=on'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; + +DROP TABLE t1; + + diff --git a/mysql-test/r/innodb_icp.result b/mysql-test/r/innodb_icp.result index 9bfa3990970..739035b005c 100644 --- a/mysql-test/r/innodb_icp.result +++ b/mysql-test/r/innodb_icp.result @@ -686,5 +686,20 @@ HAVING t1.c != 5 ORDER BY t1.c; b c 1 4 DROP TABLE t1,t2; +# +# Bug#879871: InnoDB: possible ICP + GROUP BY primary index +# +CREATE TABLE t1 ( +a int NOT NULL, b int, c varchar(1), d varchar(1), +PRIMARY KEY (a), KEY c (c,b) +); +INSERT INTO t1 VALUES (10,8,'g','g'); +SET SESSION optimizer_switch='index_condition_pushdown=off'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; +a +SET SESSION optimizer_switch='index_condition_pushdown=on'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; +a +DROP TABLE t1; set optimizer_switch=@innodb_icp_tmp; set storage_engine= @save_storage_engine; diff --git a/mysql-test/r/maria_icp.result b/mysql-test/r/maria_icp.result index f71df0a9867..2d755daf0d6 100644 --- a/mysql-test/r/maria_icp.result +++ b/mysql-test/r/maria_icp.result @@ -692,5 +692,20 @@ HAVING t1.c != 5 ORDER BY t1.c; b c 1 4 DROP TABLE t1,t2; +# +# Bug#879871: InnoDB: possible ICP + GROUP BY primary index +# +CREATE TABLE t1 ( +a int NOT NULL, b int, c varchar(1), d varchar(1), +PRIMARY KEY (a), KEY c (c,b) +); +INSERT INTO t1 VALUES (10,8,'g','g'); +SET SESSION optimizer_switch='index_condition_pushdown=off'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; +a +SET SESSION optimizer_switch='index_condition_pushdown=on'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; +a +DROP TABLE t1; set storage_engine= @save_storage_engine; set optimizer_switch=@maria_icp_tmp; diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result index 6799682c273..b73e98e2aea 100644 --- a/mysql-test/r/myisam_icp.result +++ b/mysql-test/r/myisam_icp.result @@ -690,6 +690,21 @@ HAVING t1.c != 5 ORDER BY t1.c; b c 1 4 DROP TABLE t1,t2; +# +# Bug#879871: InnoDB: possible ICP + GROUP BY primary index +# +CREATE TABLE t1 ( +a int NOT NULL, b int, c varchar(1), d varchar(1), +PRIMARY KEY (a), KEY c (c,b) +); +INSERT INTO t1 VALUES (10,8,'g','g'); +SET SESSION optimizer_switch='index_condition_pushdown=off'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; +a +SET SESSION optimizer_switch='index_condition_pushdown=on'; +SELECT a FROM t1 WHERE c IS NULL AND d IS NOT NULL GROUP BY 1; +a +DROP TABLE t1; drop table if exists t0, t1, t1i, t1m; # # BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5e1992b8816..b9088a7ce60 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -19969,7 +19969,8 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab) Item *new_cond= and_conds(cond_copy, join_tab->select->pre_idx_push_select_cond); if (!new_cond->fixed && new_cond->fix_fields(thd, &new_cond)) error= 1; - join_tab->select->pre_idx_push_select_cond= new_cond; + join_tab->pre_idx_push_select_cond= + join_tab->select->pre_idx_push_select_cond= new_cond; } join_tab->set_select_cond(cond, __LINE__); } |