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.
This commit is contained in:
Igor Babaev 2018-01-31 10:15:17 -08:00
commit 1951e7f05a
3 changed files with 27 additions and 1 deletions

View file

@ -240,7 +240,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.str) == 0)
table->table_name.str) == 0 &&
!table->is_fqtn)
{
table->set_derived();
return with_elem;