1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
unknown
2005-04-26 17:31:59 +02:00
parent 22311d2775
commit ede5261679
5 changed files with 127 additions and 0 deletions

View File

@ -594,4 +594,52 @@ alter function bug7047;
return 0;
end|
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
drop function if exists bug8408|
drop procedure if exists bug8408|
create function bug8408() returns int
begin
select * from t1;
return 0;
end|
ERROR 0A000: Not allowed to return a result set from a function
create function bug8408() returns int
begin
show warnings;
return 0;
end|
ERROR 0A000: Not allowed to return a result set from a function
create function bug8408(a int) returns int
begin
declare b int;
select b;
return b;
end|
ERROR 0A000: Not allowed to return a result set from a function
create function bug8408() returns int
begin
call bug8408();
return 0;
end|
create procedure bug8408()
select * from t1|
call bug8408()|
val x
select bug8408()|
ERROR 0A000: SELECT in a stored procedure must have INTO
drop procedure bug8408|
drop function bug8408|
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|
val x bug8408()
2 2.7 3
3 3.14 3
7 7 3
drop function bug8408|
delete from t1|
drop table t1|