summaryrefslogtreecommitdiff
path: root/sql/sql_cte.cc
diff options
context:
space:
mode:
authorGalina Shalygina <galashalygina@gmail.com>2016-05-14 23:33:50 +0300
committerGalina Shalygina <galashalygina@gmail.com>2016-05-14 23:33:50 +0300
commit3b47632bfc74a548c2f0a057f39e99a8a761a57a (patch)
tree88a61768be6280f0db62f1294c15307769a983f8 /sql/sql_cte.cc
parentd9b332bd2009cc520534bb9413e2f50c717237aa (diff)
downloadmariadb-git-3b47632bfc74a548c2f0a057f39e99a8a761a57a.tar.gz
Fixed a bug that caused crashes for SHOW CREATE VIEW <view> when <view> was recursive. Added a test case to check the fix.
Diffstat (limited to 'sql/sql_cte.cc')
-rw-r--r--sql/sql_cte.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index 7e60a8d1892..ffc54f50af1 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -330,8 +330,10 @@ With_element *With_clause::find_table_def(TABLE_LIST *table)
with_elem != NULL;
with_elem= with_elem->next_elem)
{
- if (my_strcasecmp(system_charset_info, with_elem->query_name->str, table->table_name) == 0)
+ if (my_strcasecmp(system_charset_info, with_elem->query_name->str,
+ table->table_name) == 0)
{
+ table->set_derived();
return with_elem;
}
}
@@ -740,6 +742,8 @@ bool st_select_lex::check_unrestricted_recursive()
encountered))
return true;
with_elem->owner->unrestricted|= unrestricted;
+ if (with_sum_func)
+ with_elem->owner->unrestricted|= with_elem->mutually_recursive;
return false;
}
@@ -813,7 +817,7 @@ bool With_element::check_unrestricted_recursive(st_select_lex *sel,
{
if (tab->outer_join & (JOIN_TYPE_LEFT | JOIN_TYPE_RIGHT))
{
- unrestricted|= get_elem_map();
+ unrestricted|= mutually_recursive;
break;
}
}