Commit e4bb5334 authored by Sergey Petrunya's avatar Sergey Petrunya

BUG#826935 Assertion `!table || (!table->read_set ||...

BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
- add_ref_to_table_cond() should not just overwrite pre_idx_push_select_cond
  with the contents tab->select_cond.
  pre_idx_push_select_cond exists precisely for the reason that it may contain
  a condition that is a strict superset of what is in tab->select_cond. 
  The fix is to inject generated equality into pre_idx_push_select_cond.
parent c9494dc4
......@@ -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;
......@@ -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;
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment