MDEV-16235 Server crashes in my_utf8_uni or in my_strtod_int upon
SELECT .. LIMIT 0 (new variant) This is another attempt to fix the problem of mdev-14515.
This commit is contained in:
parent
ca733d03c8
commit
147744d455
@ -712,3 +712,14 @@ a ct
|
|||||||
4 2
|
4 2
|
||||||
set sql_mode=@save_sql_mode;
|
set sql_mode=@save_sql_mode;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# mdev-16235: impossible HAVING in query without aggregation
|
||||||
|
#
|
||||||
|
explain extended
|
||||||
|
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `mysql`.`help_topic`.`help_topic_id` AS `help_topic_id`,`mysql`.`help_topic`.`name` AS `name`,`mysql`.`help_topic`.`help_category_id` AS `help_category_id`,`mysql`.`help_topic`.`description` AS `description`,`mysql`.`help_topic`.`example` AS `example`,`mysql`.`help_topic`.`url` AS `url` from `mysql`.`help_topic` where (`mysql`.`help_topic`.`example` = 'foo') having 0
|
||||||
|
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||||
|
help_topic_id name help_category_id description example url
|
||||||
|
@ -1056,7 +1056,7 @@ EXPLAIN
|
|||||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
|
||||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
||||||
f1 f2
|
f1 f2
|
||||||
SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
|
SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
|
||||||
@ -1147,7 +1147,7 @@ EXPLAIN
|
|||||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
|
||||||
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
|
||||||
f1 f2
|
f1 f2
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
@ -744,3 +744,12 @@ SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0;
|
|||||||
set sql_mode=@save_sql_mode;
|
set sql_mode=@save_sql_mode;
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # mdev-16235: impossible HAVING in query without aggregation
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
explain extended
|
||||||
|
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||||
|
|
||||||
|
select * from mysql.help_topic where example = 'foo' having description is null;
|
||||||
|
@ -5880,6 +5880,7 @@ bool JOIN::choose_tableless_subquery_plan()
|
|||||||
functions produce empty subquery result. There is no need to further
|
functions produce empty subquery result. There is no need to further
|
||||||
rewrite the subquery because it will not be executed at all.
|
rewrite the subquery because it will not be executed at all.
|
||||||
*/
|
*/
|
||||||
|
exec_const_cond= 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5911,6 +5912,6 @@ bool JOIN::choose_tableless_subquery_plan()
|
|||||||
tmp_having= having;
|
tmp_having= having;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exec_const_cond= conds;
|
exec_const_cond= zero_result_cause ? 0 : conds;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1147,7 +1147,6 @@ JOIN::optimize()
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("info", ("Zero limit"));
|
DBUG_PRINT("info", ("Zero limit"));
|
||||||
zero_result_cause= "Zero limit";
|
zero_result_cause= "Zero limit";
|
||||||
conds= 0;
|
|
||||||
}
|
}
|
||||||
table_count= top_join_tab_count= 0;
|
table_count= top_join_tab_count= 0;
|
||||||
error= 0;
|
error= 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user