=== modified file 'sql/sql_select.cc' --- sql/sql_select.cc 2009-11-05 12:13:00 +0000 +++ sql/sql_select.cc 2009-11-16 01:57:16 +0000 @@ -8719,6 +8719,12 @@ static bool make_join_select(JOIN *join, make_cond_for_table(cond, join->const_table_map, (table_map) 0, 1); + for (uint i= 0 ; i < join->const_tables ; i++) + { + JOIN_TAB *tab= join->join_tab+i; + add_cond_and_fix(&tab->select_cond, const_cond); + const_cond= tab->select_cond; + } DBUG_EXECUTE("where",print_where(const_cond,"constants", QT_ORDINARY);); for (JOIN_TAB *tab= join->join_tab+join->const_tables; tab < join->join_tab+join->tables ; tab++) @@ -8815,6 +8821,8 @@ static bool make_join_select(JOIN *join, tmp= NULL; if (cond) tmp= make_cond_for_table(cond,used_tables,current_map, 0); + add_cond_and_fix(&tab->select_cond, tmp); + tmp= tab->select_cond; if (cond && !tmp && tab->quick) { // Outer join if (tab->type != JT_ALL)