summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-03-27 14:41:17 -0700
committerIgor Babaev <igor@askmonty.org>2017-03-27 14:41:17 -0700
commit93dd70ced8919be8ff9df6581f5f1a509998b6ac (patch)
tree300bef5dfa478ddfe991867ea2596de4ae784dfe /sql/sql_union.cc
parent046d442d4c3799eb978a629c676e520654436ab5 (diff)
downloadmariadb-git-93dd70ced8919be8ff9df6581f5f1a509998b6ac.tar.gz
Fixed bug mdev-12375.
The function st_select_lex_unit::exec_recursive() incorrectly determined that a CTE mutually recursive with some others was stabilized in the case when the non-recursive part of the CTE returned an empty set. As a result the server fell into an infinite loop when executing a query using this CTE.
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 71d0e331101..f8fe8b0be00 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -1247,7 +1247,7 @@ bool st_select_lex_unit::exec_recursive()
thd->inc_examined_row_count(examined_rows);
incr_table->file->info(HA_STATUS_VARIABLE);
- if (incr_table->file->stats.records == 0)
+ if (with_element->level && incr_table->file->stats.records == 0)
with_element->set_as_stabilized();
else
with_element->level++;