diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-08-17 11:57:01 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-08-17 11:57:01 +0400 |
commit | e4bb53341f8301e982764235b3f31cb7c15d95f7 (patch) | |
tree | 17745693a86056fc5d277c38a554ef17ccfa0e52 /sql | |
parent | c9494dc42d6cf68fb20fb8e54e6cb6367336271e (diff) | |
download | mariadb-git-e4bb53341f8301e982764235b3f31cb7c15d95f7.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_select.cc | 7 |
1 files changed, 6 insertions, 1 deletions
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, |