summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-05-24 09:38:49 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-05-24 09:38:49 +0300
commit1864a8ea93aa1d1a540c83526a25df2ad0330763 (patch)
treef6d1ae8e9e696ea8537a395d061f697e5bccd4aa /sql/sql_base.cc
parentb01a9fd817d9d8e5941008d6981338eaa7369c83 (diff)
parent5c75ba9cadc7877e91d6b712f157ff5623c09c60 (diff)
downloadmariadb-git-1864a8ea93aa1d1a540c83526a25df2ad0330763.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc33
1 files changed, 4 insertions, 29 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 521e187773a..f793556cf62 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -3520,7 +3520,11 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
if (tables->derived)
{
if (!tables->view)
+ {
+ if (!tables->is_derived())
+ tables->set_derived();
goto end;
+ }
/*
We restore view's name and database wiped out by derived tables
processing and fall back to standard open process in order to
@@ -3530,35 +3534,6 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
tables->db= tables->view_db;
tables->table_name= tables->view_name;
}
- else if (tables->select_lex)
- {
- /*
- Check whether 'tables' refers to a table defined in a with clause.
- If so set the reference to the definition in tables->with.
- */
- if (!tables->with)
- tables->with= tables->select_lex->find_table_def_in_with_clauses(tables);
- /*
- If 'tables' is defined in a with clause set the pointer to the
- specification from its definition in tables->derived.
- */
- if (tables->with)
- {
- if (tables->is_recursive_with_table() &&
- !tables->is_with_table_recursive_reference())
- {
- tables->with->rec_outer_references++;
- With_element *with_elem= tables->with;
- while ((with_elem= with_elem->get_next_mutually_recursive()) !=
- tables->with)
- with_elem->rec_outer_references++;
- }
- if (tables->set_as_with_table(thd, tables->with))
- DBUG_RETURN(1);
- else
- goto end;
- }
- }
if (!tables->derived && is_infoschema_db(&tables->db))
{