diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-05-22 11:47:09 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-05-22 11:47:09 +0200 |
commit | 4ec8598c1dcb63499bce998142b8e5b8b09b2d30 (patch) | |
tree | 23010dcb3489b54b4bc9b26481a4a16a4378914a /sql/sql_union.cc | |
parent | fe3bf136b6cf83aac5a6e21d3db1c4e821612017 (diff) | |
parent | afe5a51c2df95aa282e4459afeb7f037563def92 (diff) | |
download | mariadb-git-4ec8598c1dcb63499bce998142b8e5b8b09b2d30.tar.gz |
Merge branch 'github/10.2' into 10.3
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index f74c7b5e27a..a1963c33a42 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -834,6 +834,23 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg, DBUG_ENTER("st_select_lex_unit::prepare"); DBUG_ASSERT(thd == current_thd); + if (is_recursive && (sl= first_sl->next_select())) + { + SELECT_LEX *next_sl; + for ( ; ; sl= next_sl) + { + next_sl= sl->next_select(); + if (!next_sl) + break; + if (next_sl->with_all_modifier != sl->with_all_modifier) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "mix of ALL and DISTINCT UNION operations in recursive CTE spec"); + DBUG_RETURN(TRUE); + } + } + } + describe= additional_options & SELECT_DESCRIBE; /* @@ -927,7 +944,18 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg, with_element->rec_result= new (thd->mem_root) select_union_recursive(thd); union_result= with_element->rec_result; - fake_select_lex= NULL; + if (fake_select_lex) + { + if (fake_select_lex->order_list.first || + fake_select_lex->explicit_limit) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "global ORDER_BY/LIMIT in recursive CTE spec"); + goto err; + } + fake_select_lex->cleanup(); + fake_select_lex= NULL; + } } if (!(tmp_result= union_result)) goto err; /* purecov: inspected */ |