diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2017-09-14 13:56:24 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2017-09-14 14:38:49 +0300 |
commit | 9ba635fda3cddf94223ec4800858660f007b37fe (patch) | |
tree | 23867776cdc7567280a07327721b21adf84ead8f /sql/sql_view.cc | |
parent | 7e764ae188efe3f866222eb393513bf30e2b75ab (diff) | |
download | mariadb-git-9ba635fda3cddf94223ec4800858660f007b37fe.tar.gz |
SQL: VIEW with UNION fix [fixes #269]
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 4626a0369fb..179026ce80a 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -453,10 +453,12 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, goto err; } + for (SELECT_LEX *sl= select_lex; sl; sl= sl->next_select()) { /* System Versioning: fix system fields of versioned view */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat" #pragma GCC diagnostic ignored "-Wformat-extra-args" + // Similar logic as in mysql_derived_prepare() // Leading versioning table detected implicitly (first one selected) TABLE_LIST *impli_table= NULL; // Leading versioning table specified explicitly @@ -498,7 +500,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, /* Implicitly add versioning fields if needed */ Item *item; - List_iterator_fast<Item> it(select_lex->item_list); + List_iterator_fast<Item> it(sl->item_list); DBUG_ASSERT(table->alias); while ((item= it++)) @@ -577,9 +579,9 @@ expli_table_err: if (impli_table) { - if (!expli_start && select_lex->vers_push_field(thd, impli_table, impli_start)) + if (!expli_start && sl->vers_push_field(thd, impli_table, impli_start)) goto err; - if (!expli_end && select_lex->vers_push_field(thd, impli_table, impli_end)) + if (!expli_end && sl->vers_push_field(thd, impli_table, impli_end)) goto err; } #pragma GCC diagnostic pop |