Skip to content

Commit fbed4ca

Browse files
kevgsvuvova
authored andcommitted
MDEV-14816 Assertion join->best_read < double(1.797...e+308L) failed in bool greedy_search
1 parent f96b1a4 commit fbed4ca

File tree

5 files changed

+93
-14
lines changed

5 files changed

+93
-14
lines changed

mysql-test/suite/versioning/r/partition.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ x C D
139139
## pruning check
140140
explain partitions select * from tN;
141141
id select_type table partitions type possible_keys key key_len ref rows Extra
142-
N SIMPLE tN pn system NULL NULL NULL NULL N
142+
N SIMPLE tNpN,pn system NULL NULL NULL NULL N
143143
set @str= concat('select row_start from t1 partition (pn) into @ts0');
144144
prepare stmt from @str;
145145
execute stmt;

mysql-test/suite/versioning/r/select.result

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,77 @@ insert into t1 values (1, 10, '15:01:53'), (2, 20, '00:00:00');
406406
delete from t1;
407407
select * from t1 where t = '00:00:00' and i > 0 and row_end <> '2012-12-12 00:00:00';
408408
pk i t
409+
### MDEV-14816 Assertion `join->best_read < double(1.797...e+308L)' failed in bool greedy_search
410+
create or replace table t1 (f1 int) with system versioning;
411+
create or replace table t2 (f2 int) with system versioning;
412+
create or replace table t3 (f3 int);
413+
create or replace table t4 (f4 int);
414+
insert into t1 values (1), (2), (3), (4);
415+
insert into t2 values (1), (2), (3);
416+
insert into t3 values (1), (2);
417+
insert into t4 values (1);
418+
select * from
419+
t1 as t1a
420+
left join t2 as t2a left join (t3 as t3a inner join t1) on t2a.f2 = t3a.f3 on t1a.f1 = t2a.f2
421+
left join (t2 join t3 inner join t4) on t2a.f2 = t1a.f1;
422+
f1 f2 f3 f1 f2 f3 f4
423+
1 1 1 1 1 1 1
424+
2 2 2 1 1 1 1
425+
1 1 1 2 1 1 1
426+
2 2 2 2 1 1 1
427+
1 1 1 3 1 1 1
428+
2 2 2 3 1 1 1
429+
1 1 1 4 1 1 1
430+
2 2 2 4 1 1 1
431+
1 1 1 1 1 2 1
432+
2 2 2 1 1 2 1
433+
1 1 1 2 1 2 1
434+
2 2 2 2 1 2 1
435+
1 1 1 3 1 2 1
436+
2 2 2 3 1 2 1
437+
1 1 1 4 1 2 1
438+
2 2 2 4 1 2 1
439+
1 1 1 1 2 1 1
440+
2 2 2 1 2 1 1
441+
1 1 1 2 2 1 1
442+
2 2 2 2 2 1 1
443+
1 1 1 3 2 1 1
444+
2 2 2 3 2 1 1
445+
1 1 1 4 2 1 1
446+
2 2 2 4 2 1 1
447+
1 1 1 1 2 2 1
448+
2 2 2 1 2 2 1
449+
1 1 1 2 2 2 1
450+
2 2 2 2 2 2 1
451+
1 1 1 3 2 2 1
452+
2 2 2 3 2 2 1
453+
1 1 1 4 2 2 1
454+
2 2 2 4 2 2 1
455+
1 1 1 1 3 1 1
456+
2 2 2 1 3 1 1
457+
1 1 1 2 3 1 1
458+
2 2 2 2 3 1 1
459+
1 1 1 3 3 1 1
460+
2 2 2 3 3 1 1
461+
1 1 1 4 3 1 1
462+
2 2 2 4 3 1 1
463+
1 1 1 1 3 2 1
464+
2 2 2 1 3 2 1
465+
1 1 1 2 3 2 1
466+
2 2 2 2 3 2 1
467+
1 1 1 3 3 2 1
468+
2 2 2 3 3 2 1
469+
1 1 1 4 3 2 1
470+
2 2 2 4 3 2 1
471+
3 3 NULL NULL 1 1 1
472+
3 3 NULL NULL 1 2 1
473+
3 3 NULL NULL 2 1 1
474+
3 3 NULL NULL 2 2 1
475+
3 3 NULL NULL 3 1 1
476+
3 3 NULL NULL 3 2 1
477+
4 NULL NULL NULL NULL NULL NULL
409478
drop view v1;
410-
drop table t1, t2;
479+
drop table t1, t2, t3, t4;
411480
call verify_vtq_dummy(34);
412481
No A B C D
413482
1 1 1 1 1

mysql-test/suite/versioning/r/view.result

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ x
1717
create or replace view vt1 as select * from t1;
1818
show create view vt1;
1919
View Create View character_set_client collation_connection
20-
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x` from `t1` FOR SYSTEM_TIME ALL where `t1`.`row_end` = MAX_RESULT latin1 latin1_swedish_ci
20+
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x` from `t1` FOR SYSTEM_TIME ALL where `t1`.`row_end` = MAX_RESULT or `t1`.`row_end` is nulllatin1 latin1_swedish_ci
2121
drop view vt1;
2222
drop view vt2;
2323
create or replace view vt1 as select * from t1 for system_time all;
@@ -69,7 +69,7 @@ create or replace table t1 (x int) with system versioning;
6969
create or replace view vt1(c) as select x from t1;
7070
show create view vt1;
7171
View Create View character_set_client collation_connection
72-
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `c` from `t1` FOR SYSTEM_TIME ALL where `t1`.`row_end` = MAX_RESULT latin1 latin1_swedish_ci
72+
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `c` from `t1` FOR SYSTEM_TIME ALL where `t1`.`row_end` = MAX_RESULT or `t1`.`row_end` is nulllatin1 latin1_swedish_ci
7373
# VIEW over JOIN of versioned tables [#153]
7474
create or replace table t1 (a int) with system versioning;
7575
create or replace table t2 (b int) with system versioning;
@@ -87,15 +87,15 @@ create or replace table t3 (x int);
8787
create or replace view vt1 as select * from t1, t2, t3;
8888
show create view vt1;
8989
View Create View character_set_client collation_connection
90-
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t3`.`x` AS `x` from ((`t1` FOR SYSTEM_TIME ALL join `t2` FOR SYSTEM_TIME ALL) join `t3`) where `t1`.`row_end` = MAX_RESULT and `t2`.`row_end` = MAX_RESULT latin1 latin1_swedish_ci
90+
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t3`.`x` AS `x` from ((`t1` FOR SYSTEM_TIME ALL join `t2` FOR SYSTEM_TIME ALL) join `t3`) where (`t1`.`row_end` = MAX_RESULT or `t1`.`row_end` is null) and (`t2`.`row_end` = MAX_RESULT or `t2`.`row_end` is null)latin1 latin1_swedish_ci
9191
create or replace view vt1 as select * from t3, t2, t1;
9292
show create view vt1;
9393
View Create View character_set_client collation_connection
94-
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t3`.`x` AS `x`,`t2`.`b` AS `b`,`t1`.`a` AS `a` from ((`t3` join `t2` FOR SYSTEM_TIME ALL) join `t1` FOR SYSTEM_TIME ALL) where `t2`.`row_end` = MAX_RESULT and `t1`.`row_end` = MAX_RESULT latin1 latin1_swedish_ci
94+
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t3`.`x` AS `x`,`t2`.`b` AS `b`,`t1`.`a` AS `a` from ((`t3` join `t2` FOR SYSTEM_TIME ALL) join `t1` FOR SYSTEM_TIME ALL) where (`t2`.`row_end` = MAX_RESULT or `t2`.`row_end` is null) and (`t1`.`row_end` = MAX_RESULT or `t1`.`row_end` is null)latin1 latin1_swedish_ci
9595
create or replace view vt1 as select a, t2.row_end as endo from t3, t1, t2;
9696
show create view vt1;
9797
View Create View character_set_client collation_connection
98-
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`row_end` AS `endo` from ((`t3` join `t1` FOR SYSTEM_TIME ALL) join `t2` FOR SYSTEM_TIME ALL) where `t1`.`row_end` = MAX_RESULT and `t2`.`row_end` = MAX_RESULT latin1 latin1_swedish_ci
98+
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`row_end` AS `endo` from ((`t3` join `t1` FOR SYSTEM_TIME ALL) join `t2` FOR SYSTEM_TIME ALL) where (`t1`.`row_end` = MAX_RESULT or `t1`.`row_end` is null) and (`t2`.`row_end` = MAX_RESULT or `t2`.`row_end` is null)latin1 latin1_swedish_ci
9999
# VIEW over UNION [#269]
100100
create or replace view vt1 as select * from t1 union select * from t1;
101101
select * from vt1;

mysql-test/suite/versioning/t/select.test

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,23 @@ delete from t1;
283283
select * from t1 where t = '00:00:00' and i > 0 and row_end <> '2012-12-12 00:00:00';
284284
--enable_warnings
285285

286+
--echo ### MDEV-14816 Assertion `join->best_read < double(1.797...e+308L)' failed in bool greedy_search
287+
create or replace table t1 (f1 int) with system versioning;
288+
create or replace table t2 (f2 int) with system versioning;
289+
create or replace table t3 (f3 int);
290+
create or replace table t4 (f4 int);
291+
insert into t1 values (1), (2), (3), (4);
292+
insert into t2 values (1), (2), (3);
293+
insert into t3 values (1), (2);
294+
insert into t4 values (1);
295+
select * from
296+
t1 as t1a
297+
left join t2 as t2a left join (t3 as t3a inner join t1) on t2a.f2 = t3a.f3 on t1a.f1 = t2a.f2
298+
left join (t2 join t3 inner join t4) on t2a.f2 = t1a.f1;
299+
300+
286301
drop view v1;
287-
drop table t1, t2;
302+
drop table t1, t2, t3, t4;
288303

289304
call verify_vtq_dummy(34);
290305

sql/sql_select.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -844,12 +844,6 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
844844
dst_cond= &table->on_expr;
845845
}
846846

847-
if (TABLE_LIST *t= table->embedding)
848-
{
849-
if (t->on_expr)
850-
dst_cond= &t->on_expr;
851-
}
852-
853847
const LEX_CSTRING *fstart= &table->table->vers_start_field()->field_name;
854848
const LEX_CSTRING *fend= &table->table->vers_end_field()->field_name;
855849

@@ -953,6 +947,7 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
953947
curr= newx Item_int(thd, ULONGLONG_MAX);
954948
cond1= newx Item_func_eq(thd, row_end, curr);
955949
}
950+
cond1= or_items(thd, cond1, newx Item_func_isnull(thd, row_end));
956951
break;
957952
case SYSTEM_TIME_AS_OF:
958953
cond1= newx Item_func_le(thd, row_start,

0 commit comments

Comments
 (0)