mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
SQL: CREATE VIEW with view_list from versioned table [fixes #151]
This commit is contained in:
@@ -110,6 +110,8 @@ x
|
|||||||
1
|
1
|
||||||
select * from vvvt1 for system_time all;
|
select * from vvvt1 for system_time all;
|
||||||
x
|
x
|
||||||
|
create or replace table t1 (x int) with system versioning;
|
||||||
|
create or replace view vt1(c) as select x from t1;
|
||||||
drop view vvvt1;
|
drop view vvvt1;
|
||||||
drop view vvt1;
|
drop view vvt1;
|
||||||
drop view vt1;
|
drop view vt1;
|
||||||
|
@@ -70,6 +70,9 @@ select * from vt1 for system_time all;
|
|||||||
select * from vvt1 for system_time all;
|
select * from vvt1 for system_time all;
|
||||||
select * from vvvt1 for system_time all;
|
select * from vvvt1 for system_time all;
|
||||||
|
|
||||||
|
create or replace table t1 (x int) with system versioning;
|
||||||
|
create or replace view vt1(c) as select x from t1;
|
||||||
|
|
||||||
drop view vvvt1;
|
drop view vvvt1;
|
||||||
drop view vvt1;
|
drop view vvt1;
|
||||||
drop view vt1;
|
drop view vt1;
|
||||||
|
@@ -463,12 +463,25 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||||||
TABLE_SHARE *s= tl->table->s;
|
TABLE_SHARE *s= tl->table->s;
|
||||||
if (s->versioned)
|
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(
|
select_lex->item_list.push_back(new (thd->mem_root) Item_field(
|
||||||
thd, &select_lex->context, NULL, NULL,
|
thd, &select_lex->context, NULL, NULL, start));
|
||||||
s->vers_start_field()->field_name));
|
|
||||||
select_lex->item_list.push_back(new (thd->mem_root) Item_field(
|
select_lex->item_list.push_back(new (thd->mem_root) Item_field(
|
||||||
thd, &select_lex->context, NULL, NULL,
|
thd, &select_lex->context, NULL, NULL, end));
|
||||||
s->vers_end_field()->field_name));
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user