summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-11-07 12:07:32 -0800
committerIgor Babaev <igor@askmonty.org>2018-11-07 12:08:15 -0800
commit4142589207649e3317adc8c0d371897b7cb53733 (patch)
tree95d4955ee19cc8104e0a7dcba26090b5fb65bddc /sql
parentc565622c6c6f2cb5e1dbc034a934a91f9ff08fa4 (diff)
downloadmariadb-git-4142589207649e3317adc8c0d371897b7cb53733.tar.gz
MDEV-17635 Server hangs after the query with recursive CTE
This bug in the code of the function With_element::check_unrestricted_recursive() could force a recursive CTE to be executed in a non-standard compliant mode in which recursive UNION ALL could lead to an infinite execution. This problem could occur only in the case when this CTE was used by another recursive CTE at least twice.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_cte.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index 5a590bfea93..5d4c2b20872 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1263,7 +1263,7 @@ bool With_element::check_unrestricted_recursive(st_select_lex *sel,
With_element *with_elem= unit->with_element;
if (encountered & with_elem->get_elem_map())
unrestricted|= with_elem->mutually_recursive;
- else
+ else if (with_elem ==this)
encountered|= with_elem->get_elem_map();
}
}