Commit 85416269 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-11518 Assertion `!table || (!table->read_set ||...

MDEV-11518 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_long::val_int()

QUICK_RANGE_SELECT::init_ror_merged_scan() should
also set and restore TABLE::vcol_set
parent c697ddc3
create table t1 (pk int, i int, v int as (i*2) virtual, primary key (pk), key (v)) engine=myisam;
insert into t1 (pk,i) values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
create table t2 (a int, b int) engine=myisam;
insert into t2 values (1,2),(2,4);
select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk );
pk i v a b
1 1 0 1 2
2 2 0 2 4
drop table t1, t2;
#
# MDEV-11518 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_long::val_int()
#
create table t1 (pk int, i int, v int as (i*2) virtual, primary key (pk), key (v)) engine=myisam;
insert into t1 (pk,i) values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
create table t2 (a int, b int) engine=myisam;
insert into t2 values (1,2),(2,4);
select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk );
drop table t1, t2;
...@@ -1477,6 +1477,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, ...@@ -1477,6 +1477,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler,
handler *save_file= file, *org_file; handler *save_file= file, *org_file;
my_bool org_key_read; my_bool org_key_read;
THD *thd= head->in_use; THD *thd= head->in_use;
MY_BITMAP * const save_vcol_set= head->vcol_set;
MY_BITMAP * const save_read_set= head->read_set; MY_BITMAP * const save_read_set= head->read_set;
MY_BITMAP * const save_write_set= head->write_set; MY_BITMAP * const save_write_set= head->write_set;
DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan"); DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan");
...@@ -1489,7 +1490,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, ...@@ -1489,7 +1490,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler,
{ {
DBUG_RETURN(1); DBUG_RETURN(1);
} }
head->column_bitmaps_set(&column_bitmap, &column_bitmap); head->column_bitmaps_set(&column_bitmap, &column_bitmap, &column_bitmap);
goto end; goto end;
} }
...@@ -1514,7 +1515,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, ...@@ -1514,7 +1515,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler,
goto failure; /* purecov: inspected */ goto failure; /* purecov: inspected */
} }
head->column_bitmaps_set(&column_bitmap, &column_bitmap); head->column_bitmaps_set(&column_bitmap, &column_bitmap, &column_bitmap);
if (file->ha_external_lock(thd, F_RDLCK)) if (file->ha_external_lock(thd, F_RDLCK))
goto failure; goto failure;
...@@ -1568,7 +1569,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, ...@@ -1568,7 +1569,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler,
DBUG_RETURN(0); DBUG_RETURN(0);
failure: failure:
head->column_bitmaps_set(save_read_set, save_write_set); head->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set);
delete file; delete file;
file= save_file; file= save_file;
DBUG_RETURN(1); DBUG_RETURN(1);
......
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