Commit c751c6ce authored by unknown's avatar unknown

Fixed BUG#7047: Stored procedure crash if alter procedure

  by simply disallowing alter procedure/function in an SP (as for drop).


mysql-test/r/sp-error.result:
  Added test case for BUG#7047.
mysql-test/t/sp-error.test:
  Added test case for BUG#7047.
sql/share/errmsg.txt:
  Modified error message for "update procedure/function" too.
sql/sql_yacc.yy:
  Don't allow alter procedure/function in an SP.
parent 5642bbd3
......@@ -457,9 +457,9 @@ ERROR 42S22: Unknown column 'aa' in 'order clause'
drop procedure bug2653_1|
drop procedure bug2653_2|
create procedure bug4344() drop procedure bug4344|
ERROR HY000: Can't drop a PROCEDURE from within another stored routine
ERROR HY000: Can't drop or alter a PROCEDURE from within another stored routine
create procedure bug4344() drop function bug4344|
ERROR HY000: Can't drop a FUNCTION from within another stored routine
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
drop procedure if exists bug3294|
create procedure bug3294()
begin
......@@ -585,4 +585,13 @@ end;
end;
end|
drop procedure bug9073|
create procedure bug7047()
alter procedure bug7047|
ERROR HY000: Can't drop or alter a PROCEDURE from within another stored routine
create function bug7047() returns int
begin
alter function bug7047;
return 0;
end|
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
drop table t1|
......@@ -817,6 +817,20 @@ end|
drop procedure bug9073|
#
# BUG#7047: Stored procedure crash if alter procedure
#
--error ER_SP_NO_DROP_SP
create procedure bug7047()
alter procedure bug7047|
--error ER_SP_NO_DROP_SP
create function bug7047() returns int
begin
alter function bug7047;
return 0;
end|
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -5213,7 +5213,7 @@ ER_VIEW_INVALID
eng "View '%-.64s.%-.64s' references invalid table(s) or column(s) or function(s)"
rus "View '%-.64s.%-.64s' "
ER_SP_NO_DROP_SP
eng "Can't drop a %s from within another stored routine"
eng "Can't drop or alter a %s from within another stored routine"
ER_SP_GOTO_IN_HNDLR
eng "GOTO is not allowed in a stored procedure handler"
ER_TRG_ALREADY_EXISTS
......
......@@ -3305,6 +3305,11 @@ alter:
{
LEX *lex= Lex;
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
YYABORT;
}
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
sp_a_chistics
......@@ -3318,6 +3323,11 @@ alter:
{
LEX *lex= Lex;
if (lex->sphead)
{
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
YYABORT;
}
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
}
sp_a_chistics
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment