Commit 297dcf98 authored by Igor Babaev's avatar Igor Babaev

Eliminated the member original_cond from the class SQL_SELECT

introduced at the latest merge 5.1->5.2->5.3.
It is basically not needed since if SQL_SELECT::pre_idx_push_select_cond 
is not NULL then SQL_SELECT::original_cond would point to the same condition
as SQL_SELECT::pre_idx_push_select_cond. Otherwise SQL_SELECT::original_cond
would be equal to SQL_SELECT::cond.
parent 0845e138
...@@ -1665,7 +1665,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, ...@@ -1665,7 +1665,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
select->read_tables=read_tables; select->read_tables=read_tables;
select->const_tables=const_tables; select->const_tables=const_tables;
select->head=head; select->head=head;
select->cond= select->original_cond= conds; select->cond= conds;
if (head->sort.io_cache) if (head->sort.io_cache)
{ {
......
...@@ -883,11 +883,6 @@ class SQL_SELECT :public Sql_alloc { ...@@ -883,11 +883,6 @@ class SQL_SELECT :public Sql_alloc {
public: public:
QUICK_SELECT_I *quick; // If quick-select used QUICK_SELECT_I *quick; // If quick-select used
COND *cond; // where condition COND *cond; // where condition
/*
Original WHERE condition (before anything was removed as part of index
condition pushdown.
*/
COND *original_cond;
/* /*
When using Index Condition Pushdown: condition that we've had before When using Index Condition Pushdown: condition that we've had before
......
...@@ -7423,7 +7423,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) ...@@ -7423,7 +7423,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
*/ */
if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0))) if (!(tmp= add_found_match_trig_cond(first_inner_tab, tmp, 0)))
DBUG_RETURN(1); DBUG_RETURN(1);
sel->cond= sel->original_cond= tmp; sel->cond= tmp;
tab->set_select_cond(tmp, __LINE__); tab->set_select_cond(tmp, __LINE__);
/* Push condition to storage engine if this is enabled /* Push condition to storage engine if this is enabled
and the condition is not guarded */ and the condition is not guarded */
...@@ -16432,7 +16432,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg, ...@@ -16432,7 +16432,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
/* Reset quick; This will be restored in 'use_filesort' if needed */ /* Reset quick; This will be restored in 'use_filesort' if needed */
select->quick= 0; select->quick= 0;
save_cond= select->cond; save_cond= select->cond;
select->cond= select->original_cond; if (select->pre_idx_push_select_cond)
select->cond= select->pre_idx_push_select_cond;
res= select->test_quick_select(tab->join->thd, new_ref_key_map, 0, res= select->test_quick_select(tab->join->thd, new_ref_key_map, 0,
(tab->join->select_options & (tab->join->select_options &
OPTION_FOUND_ROWS) ? OPTION_FOUND_ROWS) ?
...@@ -16816,8 +16817,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg, ...@@ -16816,8 +16817,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
Restore the original condition as changes done by pushdown Restore the original condition as changes done by pushdown
condition are not relevant anymore condition are not relevant anymore
*/ */
if (tab->select) if (tab->select && tab->select->pre_idx_push_select_cond)
tab->set_cond(tab->select->original_cond); tab->set_cond(tab->select->pre_idx_push_select_cond);
/* /*
TODO: update the number of records in join->best_positions[tablenr] TODO: update the number of records in join->best_positions[tablenr]
...@@ -18820,7 +18821,9 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab) ...@@ -18820,7 +18821,9 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
{ {
if (join_tab->select->cond) if (join_tab->select->cond)
error=(int) cond->add(join_tab->select->cond); error=(int) cond->add(join_tab->select->cond);
join_tab->select->cond= join_tab->select->original_cond= cond; join_tab->select->cond= cond;
if (join_tab->select->pre_idx_push_select_cond)
join_tab->select->pre_idx_push_select_cond= cond;
join_tab->set_select_cond(cond, __LINE__); join_tab->set_select_cond(cond, __LINE__);
} }
else if ((join_tab->select= make_select(join_tab->table, 0, 0, cond, 0, 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