[Commits] d129890e20d: MDEV-18117: Crash with Explain extended when using limit rows examined
revision-id: d129890e20d53bff1ff73391dacc0b2ad697d0e1 (mariadb-10.4.0-218-gd129890e20d) parent(s): 2465d3e00b2f18c7d4967f9bb10438883682787d author: Varun Gupta committer: Varun Gupta timestamp: 2019-01-02 23:08:01 +0530 message: 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. --- mysql-test/main/limit_rows_examined.result | 15 +++++++++++++++ mysql-test/main/limit_rows_examined.test | 12 ++++++++++++ sql/sql_yacc.yy | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result index 71b99d066ff..0711e10ddde 100644 --- a/mysql-test/main/limit_rows_examined.result +++ b/mysql-test/main/limit_rows_examined.result @@ -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 drop view v; 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; diff --git a/mysql-test/main/limit_rows_examined.test b/mysql-test/main/limit_rows_examined.test index 815394aec5c..528bb8c7b3d 100644 --- a/mysql-test/main/limit_rows_examined.test +++ b/mysql-test/main/limit_rows_examined.test @@ -576,3 +576,15 @@ EXECUTE ps; drop view v; 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; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f628ef098a1..ad51397ee71 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -12633,7 +12633,7 @@ limit_clause: { $$.select_limit= 0; $$.offset_limit= 0; - $$.explicit_limit= 1; + $$.explicit_limit= 0; Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); } ;
participants (1)
-
Varun