summaryrefslogtreecommitdiff
path: root/sql/sql_cte.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_cte.cc')
-rw-r--r--sql/sql_cte.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index 1203a4ce0c8..77f0bcf04ba 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -512,7 +512,10 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
{
With_clause *with_clause=sl->get_with_clause();
if (with_clause && (found= with_clause->find_table_def(table)))
- return found;
+ return found;
+ /* Do not look for the table's definition beyond the scope of the view */
+ if (sl->master_unit()->is_view)
+ break;
}
return found;
}