summaryrefslogtreecommitdiffstats
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 4e42bcd3..afcbb7f8 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1243,6 +1243,9 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
goto err;
JOIN *join= unit->first_select()->join;
join->first_record= false;
+ if (join->zero_result_cause)
+ goto err;
+
for (uint i= join->top_join_tab_count;
i < join->top_join_tab_count + join->aggr_tables;
i++)
@@ -1351,6 +1354,10 @@ bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived)
derived->get_unit()));
st_select_lex_unit *unit= derived->get_unit();
+ // reset item names to that saved after wildcard expansion in JOIN::prepare
+ for(st_select_lex *sl= unit->first_select(); sl; sl= sl->next_select())
+ sl->restore_item_list_names();
+
derived->merged_for_insert= FALSE;
unit->unclean();
unit->types.empty();