diff --git a/mysql-test/main/sp-bugs2.result b/mysql-test/main/sp-bugs2.result index dc56bc4f90b..0a8df79a903 100644 --- a/mysql-test/main/sp-bugs2.result +++ b/mysql-test/main/sp-bugs2.result @@ -42,4 +42,21 @@ t1test(1) wrbyviwb drop function t1test; drop table t1; +# +# MDEV-36814 MariaDB 10.11.9 Signal 11 crash on second Stored Procedure call +# +set names utf8; +create table t1 (a varchar(1000)); +create procedure p1(in p_a varchar(1000)) insert into t1 values (p_a);// +create procedure p2(in s varchar(10)) +begin +if s = '1' then set @startDate = now(); end if; +if s = '2' then set @startDate = '2025-05-23'; end if; +call p1(concat(s, @startDate, ' and ')); +end;// +call p2('1'); +call p2('2'); +drop table t1; +drop procedure p1; +drop procedure p2; # End of 10.11 tests diff --git a/mysql-test/main/sp-bugs2.test b/mysql-test/main/sp-bugs2.test index 9ef35de0899..01c6106c0ca 100644 --- a/mysql-test/main/sp-bugs2.test +++ b/mysql-test/main/sp-bugs2.test @@ -47,4 +47,24 @@ select t1test(1); drop function t1test; drop table t1; +--echo # +--echo # MDEV-36814 MariaDB 10.11.9 Signal 11 crash on second Stored Procedure call +--echo # +set names utf8; +create table t1 (a varchar(1000)); +--delimiter // +create procedure p1(in p_a varchar(1000)) insert into t1 values (p_a);// +create procedure p2(in s varchar(10)) +begin + if s = '1' then set @startDate = now(); end if; + if s = '2' then set @startDate = '2025-05-23'; end if; + call p1(concat(s, @startDate, ' and ')); +end;// +--delimiter ; +call p2('1'); +call p2('2'); +drop table t1; +drop procedure p1; +drop procedure p2; + --echo # End of 10.11 tests diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 62f0bc8fcc8..3657f8127d2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3072,11 +3072,6 @@ static bool do_execute_sp(THD *thd, sp_head *sp) ha_rows select_limit= thd->variables.select_limit; thd->variables.select_limit= HA_POS_ERROR; - /* - Reset current_select as it may point to random data as a - result of previous parsing. - */ - thd->lex->current_select= NULL; thd->lex->in_sum_func= 0; // For Item_field::fix_fields() /*