diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-09-26 20:49:51 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-09-28 16:37:06 +0200 |
commit | 57e0da50bbef8164635317785b67dd468a908327 (patch) | |
tree | 89d1ed179afce8b040c8f2dfcfe179042ff27b2e /sql/sql_derived.cc | |
parent | 7aba6f8f8853acd18d471793f8b72aa1412b8151 (diff) | |
parent | dcbd51cee628d8d8fec9ff5476a6afc855b007aa (diff) | |
download | mariadb-git-57e0da50bbef8164635317785b67dd468a908327.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 6a2e956fbf3..589d0214292 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -1106,6 +1106,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) DBUG_ASSERT(derived->table && derived->table->is_created()); select_unit *derived_result= derived->derived_result; SELECT_LEX *save_current_select= lex->current_select; + bool derived_recursive_is_filled= false; if (unit->executed && !derived_is_recursive && (unit->uncacheable & UNCACHEABLE_DEPENDENT)) @@ -1134,6 +1135,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) { /* In this case all iteration are performed */ res= derived->fill_recursive(thd); + derived_recursive_is_filled= true; } } else if (unit->is_unit_op()) @@ -1189,7 +1191,8 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) } } err: - if (res || (!lex->describe && !derived_is_recursive && !unit->uncacheable)) + if (res || (!lex->describe && !unit->uncacheable && + (!derived_is_recursive || derived_recursive_is_filled))) unit->cleanup(); lex->current_select= save_current_select; @@ -1433,4 +1436,3 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived) thd->lex->current_select= save_curr_select; DBUG_RETURN(false); } - |