summaryrefslogtreecommitdiff
path: root/sql/sql_cte.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-02-06 08:26:50 -0800
committerIgor Babaev <igor@askmonty.org>2018-02-06 08:26:50 -0800
commit90885985b6e74c64a19180a561d7e59155938d45 (patch)
tree7f6d792ca1b899ec2357afb6a2ca27583b469891 /sql/sql_cte.cc
parentb4fbb4183b35f921efe079a312b0c1be87866b40 (diff)
downloadmariadb-git-90885985b6e74c64a19180a561d7e59155938d45.tar.gz
Fixed mdev-15120 CTE table should not belong to database, that is in use
When identifying a table name the following should be taken into account: a CTE name cannot be qualified with a database name, otherwise the table name is considered as the name of a non-CTE table.
Diffstat (limited to 'sql/sql_cte.cc')
-rw-r--r--sql/sql_cte.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index ecb984cb2ce..461369bdd1d 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -223,7 +223,8 @@ With_element *With_clause::find_table_def(TABLE_LIST *table,
with_elem= with_elem->next)
{
if (my_strcasecmp(system_charset_info, with_elem->query_name->str,
- table->table_name) == 0)
+ table->table_name) == 0 &&
+ !table->is_fqtn)
{
table->set_derived();
return with_elem;