Commit 2ae2876a authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-14652 NATURAL JOIN crash in mark_common_columns() [fixes #405]

SQL: reverted NATURAL JOIN fix #161 (deprecated by #383)
parent 4be2173e
......@@ -362,6 +362,12 @@ select * from t1 for system_time as of current_timestamp;
x
select * from t1 for system_time as of now;
ERROR 42S22: Unknown column 'now' in 'where clause'
### Issue #405, NATURAL JOIN failure
create or replace table t1 (a int) with system versioning;
create or replace table t2 (b int);
create or replace view v1 as select a, sys_trx_start, sys_trx_end from t1 where a > round(rand()*1000);
select * from v1 natural join t2;
a b
drop view v1;
drop table t1, t2;
call innodb_verify_vtq(32);
......
......@@ -248,6 +248,12 @@ select * from t1 for system_time as of current_timestamp;
--error ER_BAD_FIELD_ERROR
select * from t1 for system_time as of now;
--echo ### Issue #405, NATURAL JOIN failure
create or replace table t1 (a int) with system versioning;
create or replace table t2 (b int);
create or replace view v1 as select a, sys_trx_start, sys_trx_end from t1 where a > round(rand()*1000);
select * from v1 natural join t2;
drop view v1;
drop table t1, t2;
......
......@@ -6420,15 +6420,6 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
if (nj_col_1->field() && nj_col_1->field()->vers_sys_field())
continue;
if (table_ref_1->is_view() && table_ref_1->table->versioned())
{
Item *item= nj_col_1->view_field->item;
DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
Item_field *item_field= (Item_field *)item;
if (item_field->field->vers_sys_field())
continue;
}
field_name_1= nj_col_1->name();
is_using_column_1= using_fields &&
test_if_string_in_list(field_name_1->str, using_fields);
......
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