summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-04-18 14:29:48 +0200
committerSergei Golubchik <serg@mariadb.org>2018-05-12 10:16:45 +0200
commit531acda4847996fea058f0bd4bf86c2e59f33a5f (patch)
tree9b972ae83f203cb6c5b43553a46cceba47aa354a /sql/sql_view.cc
parent0f956a0676849bdd9c98bc45867b1965909f24f3 (diff)
downloadmariadb-git-531acda4847996fea058f0bd4bf86c2e59f33a5f.tar.gz
MDEV-14820 System versioning is applied incorrectly to CTEs
Make sure that SELECT_LEX_UNIT::derived, behaves as documented (points to the "TABLE_LIST representing this union in the embedding select"). For recursive CTE this was not necessarily the case, it could've pointed to the TABLE_LIST inside the CTE, not in the embedding select. To fix: * don't update unit->derived in mysql_derived_prepare(), pass derived as an argument to st_select_lex_unit::prepare() * prefer to set unit->derived in TABLE_LIST::init_derived() to the TABLE_LIST in the embedding select, not to the recursive reference. Fail if there are many TABLE_LISTs in the embedding select with conflicting FOR SYSTEM_TIME clauses. cleanup: * remove redundant THD* argument from st_select_lex_unit::prepare()
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 903e30f43a6..711115cfdad 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -530,7 +530,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
/* prepare select to resolve all fields */
lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW;
- if (unit->prepare(thd, 0, 0))
+ if (unit->prepare(unit->derived, 0, 0))
{
/*
some errors from prepare are reported to user, if is not then