Commit ca098107 authored by Varun Gupta's avatar Varun Gupta

MDEV-18117: Crash with Explain extended when using limit rows examined

No need to set SELECT_LEX:explicit_limit when we have a limit clause
that sets only the EXAMINED ROWS
parent 18663539
...@@ -864,3 +864,18 @@ Warnings: ...@@ -864,3 +864,18 @@ Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete
drop view v; drop view v;
drop table t1, t2; drop table t1, t2;
#
# MDEV-18117: Crash with Explain extended when using limit rows examined
#
create table t1 (c1 char(2));
create table t2 (c2 char(2));
insert into t1 values ('bb'), ('cc'), ('aa'), ('dd');
insert into t2 values ('bb'), ('cc'), ('dd'), ('ff');
explain extended
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c2` = `test`.`t1`.`c1`
drop table t1,t2;
...@@ -576,3 +576,15 @@ EXECUTE ps; ...@@ -576,3 +576,15 @@ EXECUTE ps;
drop view v; drop view v;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-18117: Crash with Explain extended when using limit rows examined
--echo #
create table t1 (c1 char(2));
create table t2 (c2 char(2));
insert into t1 values ('bb'), ('cc'), ('aa'), ('dd');
insert into t2 values ('bb'), ('cc'), ('dd'), ('ff');
explain extended
select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
drop table t1,t2;
...@@ -12653,7 +12653,7 @@ limit_clause: ...@@ -12653,7 +12653,7 @@ limit_clause:
{ {
$$.select_limit= 0; $$.select_limit= 0;
$$.offset_limit= 0; $$.offset_limit= 0;
$$.explicit_limit= 1; $$.explicit_limit= 0;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT);
} }
; ;
......
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