diff options
author | pem@mysql.telia.com <> | 2003-10-03 12:39:12 +0200 |
---|---|---|
committer | pem@mysql.telia.com <> | 2003-10-03 12:39:12 +0200 |
commit | dbf45cbc3c49f1a2e7afb3cb6da510e53249f852 (patch) | |
tree | 3f14dd77ac8543b79650a405968fc562326cd0be /mysql-test | |
parent | 99c0743b4ee8b01a18434cc9156607539a5e5f13 (diff) | |
download | mariadb-git-dbf45cbc3c49f1a2e7afb3cb6da510e53249f852.tar.gz |
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).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/sp.result | 17 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 17 |
2 files changed, 34 insertions, 0 deletions
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 # |