diff options
author | unknown <pem@mysql.comhem.se> | 2005-04-26 17:31:59 +0200 |
---|---|---|
committer | unknown <pem@mysql.comhem.se> | 2005-04-26 17:31:59 +0200 |
commit | ede526167987b1b35da39a37091a27e6c8f8c6d2 (patch) | |
tree | 3e1d843329a69cf864b698ec0a864fa22df608ab /mysql-test/t/sp-error.test | |
parent | 22311d277511e5412c1dd3c3b70d7e4104c948ab (diff) | |
download | mariadb-git-ede526167987b1b35da39a37091a27e6c8f8c6d2.tar.gz |
Fixed BUG#8408: Stored procedure crash if function contains SHOW
We simply have to disallow any kind of result set being sent back
from a function. Can't see any way to make that to work.
mysql-test/r/sp-error.result:
New test case for BUG#8408.
mysql-test/t/sp-error.test:
New test case for BUG#8408.
sql/item_func.cc:
Disable result sets from functions but temporarily turning CLIENT_MULTI_RESULTS off.
sql/share/errmsg.txt:
Added error message for statements not allowed in functions (detected during parsing).
sql/sql_yacc.yy:
Don't allow result sets in functions.
Diffstat (limited to 'mysql-test/t/sp-error.test')
-rw-r--r-- | mysql-test/t/sp-error.test | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index cb4ebf080f4..b2d24167e49 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -832,6 +832,67 @@ end| # +# BUG#8408: Stored procedure crash if function contains SHOW +# BUG#9058: Stored Procedures: Crash if function included SELECT +# +--disable_warnings +drop function if exists bug8408| +drop procedure if exists bug8408| +--enable_warnings + +# Some things are caught when parsing +--error ER_SP_NO_RETSET_IN_FUNC +create function bug8408() returns int +begin + select * from t1; + return 0; +end| +--error ER_SP_NO_RETSET_IN_FUNC +create function bug8408() returns int +begin + show warnings; + return 0; +end| +--error ER_SP_NO_RETSET_IN_FUNC +create function bug8408(a int) returns int +begin + declare b int; + select b; + return b; +end| + +# Some things must be caught at invokation time +create function bug8408() returns int +begin + call bug8408(); + return 0; +end| +create procedure bug8408() + select * from t1| + +call bug8408()| +--error ER_SP_BADSELECT +select bug8408()| + +drop procedure bug8408| +drop function bug8408| + +# But this is ok +create function bug8408() returns int +begin + declare n int default 0; + select count(*) into n from t1; + return n; +end| + +insert into t1 value (2, 2.7), (3, 3.14), (7, 7.0)| +select *,bug8408() from t1| + +drop function bug8408| +delete from t1| + + +# # BUG#NNNN: New bug synopsis # #--disable_warnings |