summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-01-11 18:00:31 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-01-11 18:00:31 +0200
commitcca611d1c083286396e34d8fc242bbeb90f01d2a (patch)
tree6905df14f4617bcaac9b0ea8a30b8017e201462f /sql/sql_parse.cc
parent773c3ceb573ea5ae8506237d3648412251ce02e7 (diff)
parentbf7719111fff5167e160abf869c03a81a3a39592 (diff)
downloadmariadb-git-cca611d1c083286396e34d8fc242bbeb90f01d2a.tar.gz
Merge 10.2 into bb-10.2-ext
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc22
1 files changed, 5 insertions, 17 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 3c73b2f797b..a24a6955dc3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3243,6 +3243,9 @@ mysql_execute_command(THD *thd)
thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
}
+ if (check_dependencies_in_with_clauses(thd->lex->with_clauses_list))
+ DBUG_RETURN(1);
+
#ifdef HAVE_REPLICATION
if (unlikely(thd->slave_thread))
{
@@ -3700,14 +3703,6 @@ mysql_execute_command(THD *thd)
ulong privileges_requested= lex->exchange ? SELECT_ACL | FILE_ACL :
SELECT_ACL;
- /*
- The same function must be called for DML commands
- when CTEs are supported in DML statements
- */
- res= check_dependencies_in_with_clauses(thd->lex->with_clauses_list);
- if (res)
- break;
-
if (all_tables)
res= check_table_access(thd,
privileges_requested,
@@ -4134,8 +4129,7 @@ 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;
- if (!(res= check_dependencies_in_with_clauses(lex->with_clauses_list)))
- res= open_and_lock_tables(thd, create_info, lex->query_tables, TRUE, 0);
+ 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)
{
@@ -4749,8 +4743,7 @@ end_with_restore_list:
unit->set_limit(select_lex);
- if (!(res= check_dependencies_in_with_clauses(lex->with_clauses_list)) &&
- !(res=open_and_lock_tables(thd, all_tables, TRUE, 0)))
+ if (!(res=open_and_lock_tables(thd, all_tables, TRUE, 0)))
{
MYSQL_INSERT_SELECT_START(thd->query());
/*
@@ -5081,9 +5074,6 @@ end_with_restore_list:
{
List<set_var_base> *lex_var_list= &lex->var_list;
- if (check_dependencies_in_with_clauses(thd->lex->with_clauses_list))
- goto error;
-
if ((check_table_access(thd, SELECT_ACL, all_tables, FALSE, UINT_MAX, FALSE)
|| open_and_lock_tables(thd, all_tables, TRUE, 0)))
goto error;
@@ -6402,8 +6392,6 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
new (thd->mem_root) Item_int(thd,
(ulonglong) thd->variables.select_limit);
}
- if (check_dependencies_in_with_clauses(lex->with_clauses_list))
- return 1;
if (!(res= open_and_lock_tables(thd, all_tables, TRUE, 0)))
{