diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-09-22 17:50:37 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-09-22 17:50:37 +0200 |
commit | f32a5115584c9b33a2163df57830ad335cd2b3ab (patch) | |
tree | eb121e6577aa86edc7a1a604b6bc6b40bb7d90ba /sql | |
parent | f7640e1194793cc4252ad168937a4233ed9a632b (diff) | |
parent | 272637887c58ce43ee4f866ca8e212680abdadf6 (diff) | |
download | mariadb-git-f32a5115584c9b33a2163df57830ad335cd2b3ab.tar.gz |
Merge branch '10.2' into bb-10.2-connector-c-integ-subm
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_parse.cc | 6 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 26 |
2 files changed, 22 insertions, 10 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()); /* diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 551a86e4a41..1facf0623d4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4810,16 +4810,22 @@ create_like: opt_create_select: /* empty */ {} - | opt_duplicate opt_as create_select_query_expression_body + | opt_duplicate opt_as create_select_query_expression ; -create_select_query_expression_body: - SELECT_SYM create_select_part2 opt_table_expression +create_select_query_expression: + opt_with_clause SELECT_SYM create_select_part2 opt_table_expression create_select_part4 - { Select->set_braces(0);} + { + Select->set_braces(0); + Select->set_with_clause($1); + } union_clause - | SELECT_SYM create_select_part2 create_select_part3_union_not_ready - create_select_part4 + | opt_with_clause SELECT_SYM create_select_part2 + create_select_part3_union_not_ready create_select_part4 + { + Select->set_with_clause($1); + } | '(' create_select_query_specification ')' | '(' create_select_query_specification ')' { Select->set_braces(1);} union_list {} @@ -5519,7 +5525,11 @@ opt_part_option: */ create_select_query_specification: - SELECT_SYM create_select_part2 create_select_part3 create_select_part4 + SELECT_SYM opt_with_clause create_select_part2 create_select_part3 + create_select_part4 + { + Select->set_with_clause($2); + } ; create_select_part2: @@ -12308,7 +12318,7 @@ fields: insert_values: VALUES values_list {} | VALUE_SYM values_list {} - | create_select_query_expression_body {} + | create_select_query_expression {} ; values_list: |