From 54efb080227cf3f79efb7ab2660bf66582cd07fd Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Sat, 24 Sep 2016 21:04:54 -0700 Subject: Fixed bug mdev-10881 The server missed to call check_dependencies_in_with_clauses() when processing PREPARE ... FROM CREATE ... SELECT / INSERT ... SELECT with WITH clause before SELECT. --- sql/sql_prepare.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/sql_prepare.cc') diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index eab2863588d..df15a629802 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1777,6 +1777,9 @@ static bool mysql_test_create_table(Prepared_statement *stmt) if (create_table_precheck(thd, tables, create_table)) DBUG_RETURN(TRUE); + if (check_dependencies_in_with_clauses(lex->with_clauses_list)) + DBUG_RETURN(TRUE); + if (select_lex->item_list.elements) { /* Base table and temporary table are not in the same name space. */ @@ -2167,6 +2170,9 @@ static bool mysql_test_insert_select(Prepared_statement *stmt, if (insert_precheck(stmt->thd, tables)) return 1; + if (check_dependencies_in_with_clauses(lex->with_clauses_list)) + return 1; + /* store it, because mysql_insert_select_prepare_tester change it */ first_local_table= lex->select_lex.table_list.first; DBUG_ASSERT(first_local_table != 0); -- cgit v1.2.1