1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-16235 Server crashes in my_utf8_uni or in my_strtod_int

upon SELECT .. LIMIT 0

The code must differentiate between a SELECT with contradictory
WHERE/HAVING and one with LIMIT 0.
Also for the latter printed 'Zero limit' instead of 'Impossible where'
in the EXPLAIN output.
This commit is contained in:
Igor Babaev
2018-05-22 12:09:05 -07:00
parent 27a7365f42
commit 6a04c2a1aa
6 changed files with 46 additions and 7 deletions

View File

@ -1136,10 +1136,19 @@ JOIN::optimize()
if (cond_value == Item::COND_FALSE || having_value == Item::COND_FALSE ||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
{ /* Impossible cond */
DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
"Impossible HAVING" : "Impossible WHERE"));
zero_result_cause= having_value == Item::COND_FALSE ?
"Impossible HAVING" : "Impossible WHERE";
if (unit->select_limit_cnt)
{
DBUG_PRINT("info", (having_value == Item::COND_FALSE ?
"Impossible HAVING" : "Impossible WHERE"));
zero_result_cause= having_value == Item::COND_FALSE ?
"Impossible HAVING" : "Impossible WHERE";
}
else
{
DBUG_PRINT("info", ("Zero limit"));
zero_result_cause= "Zero limit";
conds= 0;
}
table_count= top_join_tab_count= 0;
error= 0;
goto setup_subq_exit;