BUG#834514: Assertion `!table || (!table->read_set || bitmap_is_set(...' with aggregates
- Make find_all_keys() not to rely on table->tmp_set remaining constant during execution quick_index_merge_select->reset() may change it.
This commit is contained in:
parent
28a7050912
commit
5be4148e58
@ -1594,4 +1594,24 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge a,b,c a,c 5,5 NULL 54 Using sort_union(a,c); Using where
|
||||
set optimizer_switch=default;
|
||||
drop table t0, t1;
|
||||
#
|
||||
# BUG#834514 Assertion `!table || (!table->read_set || bitmap_is_set(...' with aggregates
|
||||
#
|
||||
CREATE TABLE t1 ( a int , b int, c int, KEY (b), PRIMARY KEY (a)) ;
|
||||
INSERT INTO t1 VALUES (1,4,0),(5,0,0),(6,7,0),(7,7,0),(8,1,0),(9,7,0),(10,1,0);
|
||||
CREATE TABLE t2 ( b int, c int, KEY (c,b)) ;
|
||||
INSERT INTO t2 VALUES (7,0),(1,0),(7,0),(1,0);
|
||||
CREATE TABLE t3 ( a int ) ;
|
||||
SELECT COUNT(DISTINCT t2.b), CONCAT(t1.c)
|
||||
FROM t1, t2
|
||||
WHERE (t2.c = t1.c)
|
||||
AND (
|
||||
t1.b IN ( 4 )
|
||||
OR t1.a = 137
|
||||
AND EXISTS ( SELECT a FROM t3 )
|
||||
)
|
||||
GROUP BY 2;
|
||||
COUNT(DISTINCT t2.b) CONCAT(t1.c)
|
||||
2 0
|
||||
DROP TABLE t1,t2,t3;
|
||||
set optimizer_switch= @optimizer_switch_save;
|
||||
|
@ -125,5 +125,29 @@ set optimizer_switch=default;
|
||||
|
||||
drop table t0, t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # BUG#834514 Assertion `!table || (!table->read_set || bitmap_is_set(...' with aggregates
|
||||
--echo #
|
||||
CREATE TABLE t1 ( a int , b int, c int, KEY (b), PRIMARY KEY (a)) ;
|
||||
INSERT INTO t1 VALUES (1,4,0),(5,0,0),(6,7,0),(7,7,0),(8,1,0),(9,7,0),(10,1,0);
|
||||
|
||||
CREATE TABLE t2 ( b int, c int, KEY (c,b)) ;
|
||||
INSERT INTO t2 VALUES (7,0),(1,0),(7,0),(1,0);
|
||||
|
||||
CREATE TABLE t3 ( a int ) ;
|
||||
|
||||
SELECT COUNT(DISTINCT t2.b), CONCAT(t1.c)
|
||||
FROM t1, t2
|
||||
WHERE (t2.c = t1.c)
|
||||
AND (
|
||||
t1.b IN ( 4 )
|
||||
OR t1.a = 137
|
||||
AND EXISTS ( SELECT a FROM t3 )
|
||||
)
|
||||
GROUP BY 2;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
set optimizer_switch= @optimizer_switch_save;
|
||||
|
||||
|
@ -624,15 +624,21 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
|
||||
SQL_SELECT::skip_record evaluates this condition. it may include a
|
||||
correlated subquery predicate, such that some field in the subquery
|
||||
refers to 'sort_form'.
|
||||
|
||||
PSergey-todo: discuss the above with Timour.
|
||||
*/
|
||||
MY_BITMAP *tmp_read_set= sort_form->read_set;
|
||||
MY_BITMAP *tmp_write_set= sort_form->write_set;
|
||||
MY_BITMAP *tmp_vcol_set= sort_form->vcol_set;
|
||||
|
||||
if (select->cond->with_subselect)
|
||||
sort_form->column_bitmaps_set(save_read_set, save_write_set,
|
||||
save_vcol_set);
|
||||
write_record= (select->skip_record(thd) > 0);
|
||||
if (select->cond->with_subselect)
|
||||
sort_form->column_bitmaps_set(&sort_form->tmp_set,
|
||||
&sort_form->tmp_set,
|
||||
&sort_form->tmp_set);
|
||||
sort_form->column_bitmaps_set(tmp_read_set,
|
||||
tmp_write_set,
|
||||
tmp_vcol_set);
|
||||
}
|
||||
else
|
||||
write_record= true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user