diff options
author | kevg <claprix@yandex.ru> | 2017-03-13 14:29:21 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2017-05-05 20:36:30 +0300 |
commit | a37cf5258b69c88d555fee73d3df0978aab226d3 (patch) | |
tree | cbdb0109eb74197af5f140961d69d04e503b2c9a /sql/sql_view.cc | |
parent | 4782b74023083b9d5956c76c7c444f1a3f6a3419 (diff) | |
download | mariadb-git-a37cf5258b69c88d555fee73d3df0978aab226d3.tar.gz |
SQL: CREATE VIEW with view_list from versioned table [fixes #151]
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 8ee4a75e259..215d81f5724 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -463,12 +463,25 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, TABLE_SHARE *s= tl->table->s; if (s->versioned) { + const char *start= s->vers_start_field()->field_name; + const char *end = s->vers_end_field()->field_name; + select_lex->item_list.push_back(new (thd->mem_root) Item_field( - thd, &select_lex->context, NULL, NULL, - s->vers_start_field()->field_name)); + thd, &select_lex->context, NULL, NULL, start)); select_lex->item_list.push_back(new (thd->mem_root) Item_field( - thd, &select_lex->context, NULL, NULL, - s->vers_end_field()->field_name)); + thd, &select_lex->context, NULL, NULL, end)); + + if (lex->view_list.elements) + { + if (LEX_STRING *s= thd->make_lex_string(start, strlen(start))) + lex->view_list.push_back(s); + else + goto err; + if (LEX_STRING *s= thd->make_lex_string(end, strlen(end))) + lex->view_list.push_back(s); + else + goto err; + } } } } |