From dbf45cbc3c49f1a2e7afb3cb6da510e53249f852 Mon Sep 17 00:00:00 2001 From: "pem@mysql.telia.com" <> Date: Fri, 3 Oct 2003 12:39:12 +0200 Subject: Fixed BUG#822: Copying and clearing some things in thd/lex when executing sub-statements (selects) prevents crashes intermittent crashes. Also fixed bug in sql_yacc.yy (generated a hpop instruction when not needed). --- mysql-test/r/sp.result | 17 +++++++++++++++++ mysql-test/t/sp.test | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 42f720c7791..c8652b25b2e 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -500,6 +500,23 @@ id data hndlr3 13 delete from t1; drop procedure hndlr3; +create procedure bug822(a_id char(16), a_data int) +begin +declare n int; +select count(*) into n from t1 where id = a_id and data = a_data; +if n = 0 then +insert into t1 (id, data) values (a_id, a_data); +end if; +end; +call bug822('foo', 42); +call bug822('foo', 42); +call bug822('bar', 666); +select * from t1; +id data +foo 42 +bar 666 +delete from t1; +drop procedure bug822; drop table if exists fac; create table fac (n int unsigned not null primary key, f bigint unsigned); create procedure ifac(n int unsigned) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 3450b47b4e5..43deb12b379 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -589,6 +589,23 @@ delete from t1| drop procedure hndlr3| +create procedure bug822(a_id char(16), a_data int) +begin + declare n int; + select count(*) into n from t1 where id = a_id and data = a_data; + if n = 0 then + insert into t1 (id, data) values (a_id, a_data); + end if; +end| + +call bug822('foo', 42)| +call bug822('foo', 42)| +call bug822('bar', 666)| +select * from t1| +delete from t1| +drop procedure bug822| + + # # Some "real" examples # -- cgit v1.2.1