summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpem@mysql.com <>2005-04-20 18:00:51 +0200
committerpem@mysql.com <>2005-04-20 18:00:51 +0200
commitab0ff5349d72481c87646efbddfac98a714e3f67 (patch)
tree967b11b5abd4bad029568f65db6adb2b377990c5
parent32a872938ea90cbf23ab78e25bd9348f307f881f (diff)
parent54dfe4a66a5bc2a17098aa0597b3a1a299cb61f0 (diff)
downloadmariadb-git-ab0ff5349d72481c87646efbddfac98a714e3f67.tar.gz
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
-rw-r--r--mysql-test/r/sp-error.result13
-rw-r--r--mysql-test/r/sp.result9
-rw-r--r--mysql-test/t/sp-error.test14
-rw-r--r--mysql-test/t/sp.test16
-rw-r--r--sql/share/errmsg.txt2
-rw-r--r--sql/sp_head.cc2
-rw-r--r--sql/sql_yacc.yy10
7 files changed, 62 insertions, 4 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 3f224d790f7..5ee1d46f3c9 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -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|
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 4bb1640f0eb..d911fc68b7c 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -2958,4 +2958,13 @@ select @x|
set global query_cache_size = @qcs1|
delete from t1|
drop function bug9902|
+drop procedure if exists bug6898|
+create procedure bug6898()
+begin
+goto label1;
+label label1;
+begin end;
+goto label1;
+end|
+drop procedure bug6898|
drop table t1,t2;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index ecbc98f86e9..cb4ebf080f4 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -818,6 +818,20 @@ 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
#
#--disable_warnings
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 4101a7a4bfa..d5298645f76 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -3629,6 +3629,22 @@ drop function bug9902|
#
+# BUG#6898: Stored procedure crash if GOTO statements exist
+#
+--disable_warnings
+drop procedure if exists bug6898|
+--enable_warnings
+create procedure bug6898()
+begin
+ goto label1;
+ label label1;
+ begin end;
+ goto label1;
+end|
+drop procedure bug6898|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index e93229a4a3e..8d7a1fe0093 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -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
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 0fe9c449540..c505ef05b57 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1499,7 +1499,7 @@ sp_instr_jump::opt_shortcut_jump(sp_head *sp, sp_instr *start)
{
uint ndest;
- if (start == i)
+ if (start == i || this == i)
break;
ndest= i->opt_shortcut_jump(sp, start);
if (ndest == dest)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 9aa5d7fb4fc..7f5255aa764 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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