Commit 7a22dd37 authored by kevg's avatar kevg Committed by Aleksey Midenkov

SQL: INNER JOIN USING with versioned tables [fixes #147]

parent 9355e3e9
...@@ -409,7 +409,16 @@ ERROR HY000: Wrong parameters for `FOR SYSTEM_TIME query`: write-locking of hist ...@@ -409,7 +409,16 @@ ERROR HY000: Wrong parameters for `FOR SYSTEM_TIME query`: write-locking of hist
create or replace table t1 (a int not null auto_increment primary key) with system versioning; create or replace table t1 (a int not null auto_increment primary key) with system versioning;
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1; select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
a a
drop table t1; create or replace table t1 (a int) with system versioning;
create or replace table t2 (a int) with system versioning;
insert into t1 values(1);
insert into t2 values(1);
create view v1 as select * from t2 inner join t1 using (a);
select * from v1;
a
1
drop view v1;
drop table t1, t2;
call verify_vtq; call verify_vtq;
No A B C D No A B C D
1 1 1 1 1 1 1 1 1 1
......
...@@ -134,7 +134,15 @@ select * from t1 for system_time all for update; ...@@ -134,7 +134,15 @@ select * from t1 for system_time all for update;
create or replace table t1 (a int not null auto_increment primary key) with system versioning; create or replace table t1 (a int not null auto_increment primary key) with system versioning;
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1; select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
drop table t1; create or replace table t1 (a int) with system versioning;
create or replace table t2 (a int) with system versioning;
insert into t1 values(1);
insert into t2 values(1);
create view v1 as select * from t2 inner join t1 using (a);
select * from v1;
drop view v1;
drop table t1, t2;
call verify_vtq; call verify_vtq;
......
...@@ -5350,7 +5350,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name, ...@@ -5350,7 +5350,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
{ {
if (!my_strcasecmp(system_charset_info, curr_nj_col->name(), name)) if (!my_strcasecmp(system_charset_info, curr_nj_col->name(), name))
{ {
if (nj_col) if (nj_col && !curr_nj_col->table_field->field->vers_sys_field())
{ {
my_error(ER_NON_UNIQ_ERROR, MYF(0), name, thd->where); my_error(ER_NON_UNIQ_ERROR, MYF(0), name, thd->where);
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
......
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