Commit b7408be0 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-20753: Sequence with limit 0 crashes server

Do not try to push down conditions to engine if query was resolved without tables (and so the engine).
parent b1ac1742
...@@ -2795,7 +2795,7 @@ bool JOIN::make_aggr_tables_info() ...@@ -2795,7 +2795,7 @@ bool JOIN::make_aggr_tables_info()
distinct in the engine, so we do this for all queries, not only distinct in the engine, so we do this for all queries, not only
GROUP BY queries. GROUP BY queries.
*/ */
if (tables_list && !procedure) if (tables_list && top_join_tab_count && !procedure)
{ {
/* /*
At the moment we only support push down for queries where At the moment we only support push down for queries where
......
...@@ -97,3 +97,9 @@ count(NULL) ...@@ -97,3 +97,9 @@ count(NULL)
select count(NULL) from seq_1_to_3; select count(NULL) from seq_1_to_3;
count(NULL) count(NULL)
0 0
#
# MDEV-20753: Sequence with limit 0 crashes server
#
select count(NULL) from seq_1_to_3 limit 0;
count(NULL)
# End of 10.3 tests
...@@ -49,3 +49,10 @@ explain select count(*) from seq_1_to_15_step_2 group by mod(seq,2); ...@@ -49,3 +49,10 @@ explain select count(*) from seq_1_to_15_step_2 group by mod(seq,2);
create temporary table t1 select * from seq_1_to_3; create temporary table t1 select * from seq_1_to_3;
select count(NULL) from t1; select count(NULL) from t1;
select count(NULL) from seq_1_to_3; select count(NULL) from seq_1_to_3;
--echo #
--echo # MDEV-20753: Sequence with limit 0 crashes server
--echo #
select count(NULL) from seq_1_to_3 limit 0;
--echo # End of 10.3 tests
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