diff options
author | Igor Babaev <igor@askmonty.org> | 2018-11-07 12:07:32 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2018-11-07 12:08:15 -0800 |
commit | 4142589207649e3317adc8c0d371897b7cb53733 (patch) | |
tree | 95d4955ee19cc8104e0a7dcba26090b5fb65bddc /sql/sql_cte.cc | |
parent | c565622c6c6f2cb5e1dbc034a934a91f9ff08fa4 (diff) | |
download | mariadb-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/sql_cte.cc')
-rw-r--r-- | sql/sql_cte.cc | 2 |
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(); } } |