summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2016-09-22 01:45:05 -0700
committerIgor Babaev <igor@askmonty.org>2016-09-22 01:45:05 -0700
commit48b4e33596597b2c883adb0608729d69ffbe9ff5 (patch)
tree16b5e4e93597e3f026c799e49d47b103b0d41af5 /sql/sql_parse.cc
parent4368efe870f225279106798f71978b68c473e2ab (diff)
downloadmariadb-git-bb-10.2-mdev9864.tar.gz
Allowed to use WITH clauses before SELECT in CREATE ... SELECTbb-10.2-mdev9864
and INSERT ... SELECT. Added test cases.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index effc0230536..ac00b21c837 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3781,7 +3781,8 @@ mysql_execute_command(THD *thd)
/* Copy temporarily the statement flags to thd for lock_table_names() */
uint save_thd_create_info_options= thd->lex->create_info.options;
thd->lex->create_info.options|= create_info.options;
- res= open_and_lock_tables(thd, create_info, lex->query_tables, TRUE, 0);
+ if (!(res= check_dependencies_in_with_clauses(lex->with_clauses_list)))
+ res= open_and_lock_tables(thd, create_info, lex->query_tables, TRUE, 0);
thd->lex->create_info.options= save_thd_create_info_options;
if (res)
{
@@ -4394,7 +4395,8 @@ end_with_restore_list:
unit->set_limit(select_lex);
- if (!(res= open_and_lock_tables(thd, all_tables, TRUE, 0)))
+ if (!(res= check_dependencies_in_with_clauses(lex->with_clauses_list)) &&
+ !(res=open_and_lock_tables(thd, all_tables, TRUE, 0)))
{
MYSQL_INSERT_SELECT_START(thd->query());
/*