Commit 4ebf680c authored by kevg's avatar kevg Committed by Aleksey Midenkov

SQL: VIEW over a JOIN of versioned tables [fixes #153]

parent 92c7a871
...@@ -112,7 +112,16 @@ select * from vvvt1 for system_time all; ...@@ -112,7 +112,16 @@ select * from vvvt1 for system_time all;
x x
create or replace table t1 (x int) with system versioning; create or replace table t1 (x int) with system versioning;
create or replace view vt1(c) as select x from t1; create or replace view vt1(c) as select x from t1;
drop view vvvt1; create or replace table t1 (a int) with system versioning;
drop view vvt1; create or replace table t2 (b int) with system versioning;
drop view vt1; insert into t1 values (1);
drop table t1; insert into t2 values (2);
create or replace view vt12 as select * from t1 cross join t2;
select * from vt12;
a b
1 2
create or replace view vt12 as select * from t1 for system_time as of timestamp '0-0-0' cross join t2;
select * from vt12;
a b
drop view vt1, vvt1, vvvt1, vt12;
drop table t1, t2;
...@@ -73,7 +73,14 @@ select * from vvvt1 for system_time all; ...@@ -73,7 +73,14 @@ select * from vvvt1 for system_time all;
create or replace table t1 (x int) with system versioning; create or replace table t1 (x int) with system versioning;
create or replace view vt1(c) as select x from t1; create or replace view vt1(c) as select x from t1;
drop view vvvt1; create or replace table t1 (a int) with system versioning;
drop view vvt1; create or replace table t2 (b int) with system versioning;
drop view vt1; insert into t1 values (1);
drop table t1; insert into t2 values (2);
create or replace view vt12 as select * from t1 cross join t2;
select * from vt12;
create or replace view vt12 as select * from t1 for system_time as of timestamp '0-0-0' cross join t2;
select * from vt12;
drop view vt1, vvt1, vvvt1, vt12;
drop table t1, t2;
...@@ -467,9 +467,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -467,9 +467,9 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
const char *end = s->vers_end_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, start)); thd, &select_lex->context, tables->db, tables->alias, start));
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, end)); thd, &select_lex->context, tables->db, tables->alias, end));
if (lex->view_list.elements) if (lex->view_list.elements)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment