summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/myisam_icp.result14
-rw-r--r--mysql-test/t/myisam_icp.test14
-rw-r--r--sql/sql_select.cc7
3 files changed, 34 insertions, 1 deletions
diff --git a/mysql-test/r/myisam_icp.result b/mysql-test/r/myisam_icp.result
index efcfa0edc87..d3e1114b39c 100644
--- a/mysql-test/r/myisam_icp.result
+++ b/mysql-test/r/myisam_icp.result
@@ -224,4 +224,18 @@ set optimizer_switch= @tmp_778434;
set @myisam_icp_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
drop table if exists t0, t1, t1i, t1m;
+#
+# BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
+#
+CREATE TABLE t1 ( a int, b varchar(1024), c int, KEY (c), KEY (c,a)) ;
+INSERT INTO t1 VALUES
+(NULL,'x','-678428672'),
+(NULL,'ok',NULL),
+(796262400,'byluovkgwoukfxedyeffsedajyqkyhpaqqpozn', NULL),
+(7,'STQUF',146014208),
+(955711488,'WWVOR','-1515388928');
+SELECT b FROM t1 WHERE a != 1 AND c IS NULL ORDER BY 1;
+b
+byluovkgwoukfxedyeffsedajyqkyhpaqqpozn
+DROP TABLE t1;
set optimizer_switch=@myisam_icp_tmp;
diff --git a/mysql-test/t/myisam_icp.test b/mysql-test/t/myisam_icp.test
index 7cc35a25e91..66ffbfa3821 100644
--- a/mysql-test/t/myisam_icp.test
+++ b/mysql-test/t/myisam_icp.test
@@ -195,4 +195,18 @@ drop table if exists t0, t1, t1i, t1m;
drop table t0, t1, t1i, t1m;
--enable_parsing
+
+--echo #
+--echo # BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
+--echo #
+CREATE TABLE t1 ( a int, b varchar(1024), c int, KEY (c), KEY (c,a)) ;
+INSERT INTO t1 VALUES
+ (NULL,'x','-678428672'),
+ (NULL,'ok',NULL),
+ (796262400,'byluovkgwoukfxedyeffsedajyqkyhpaqqpozn', NULL),
+ (7,'STQUF',146014208),
+ (955711488,'WWVOR','-1515388928');
+SELECT b FROM t1 WHERE a != 1 AND c IS NULL ORDER BY 1;
+DROP TABLE t1;
+
set optimizer_switch=@myisam_icp_tmp;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 83da3d157de..e0b228fc45a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -19872,7 +19872,12 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
error=(int) cond->add(join_tab->select->cond);
join_tab->select->cond= cond;
if (join_tab->select->pre_idx_push_select_cond)
- join_tab->select->pre_idx_push_select_cond= cond;
+ {
+ Item *new_cond= and_conds(join_tab->select->pre_idx_push_select_cond, 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->set_select_cond(cond, __LINE__);
}
else if ((join_tab->select= make_select(join_tab->table, 0, 0, cond, 0,