diff options
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a640e44ebe1..aa23f01ab7d 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8062,8 +8062,20 @@ static bool do_fill_table(THD *thd, da->push_warning_info(&wi_tmp); - bool res= table_list->schema_table->fill_table( - thd, table_list, join_table->select_cond); + Item *item= join_table->select_cond; + if (join_table->cache_select && + join_table->cache_select->cond) + { + /* + If join buffering is used, we should use the condition that is attached + to the join cache. Cache condition has a part of WHERE that can be + checked when we're populating this table. + join_tab->select_cond is of no interest, because it only has conditions + that depend on both this table and previous tables in the join order. + */ + item= join_table->cache_select->cond; + } + bool res= table_list->schema_table->fill_table(thd, table_list, item); da->pop_warning_info(); |