1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed BUG#434: Stored procedure which drops itself causes crash.

Simply disallow it, just as we disallow creation of routines from within
other SPs.


include/mysqld_error.h:
  New error code for when attempting to drop a stored routine from within
  another stored routine.
mysql-test/r/sp-error.result:
  New test case for BUG#4344.
mysql-test/t/sp-error.test:
  New test case for BUG#4344.
sql/share/czech/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/danish/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/dutch/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/english/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/estonian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/french/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/german/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/greek/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/hungarian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/italian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/japanese/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/korean/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/norwegian-ny/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/norwegian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/polish/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/portuguese/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/romanian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/russian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/serbian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/slovak/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/spanish/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/swedish/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/share/ukrainian/errmsg.txt:
  New error message for when attempting to drop a stored routine from within
  another stored routine.
sql/sql_yacc.yy:
  Don't allow drop function/procedure from within another function/procedure.
This commit is contained in:
unknown
2004-07-29 17:33:45 +02:00
parent 96aeecf237
commit 4467bcf26e
27 changed files with 48 additions and 1 deletions

View File

@ -372,4 +372,5 @@
#define ER_WARN_VIEW_MERGE 1353
#define ER_WARN_VIEW_WITHOUT_KEY 1354
#define ER_VIEW_INVALID 1355
#define ER_ERROR_MESSAGES 356
#define ER_SP_NO_DROP_SP 1356
#define ER_ERROR_MESSAGES 357

View File

@ -413,4 +413,8 @@ call bug2653_2(2, @b)|
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
create procedure bug4344() drop function bug4344|
ERROR HY000: Can't drop a FUNCTION from within another stored routine
drop table t1|

View File

@ -576,6 +576,15 @@ call bug2653_2(2, @b)|
drop procedure bug2653_1|
drop procedure bug2653_2|
#
# BUG#4344
#
--error 1356
create procedure bug4344() drop procedure bug4344|
--error 1356
create procedure bug4344() drop function bug4344|
drop table t1|
delimiter ;|

View File

@ -368,3 +368,4 @@ character-set=latin2
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -362,3 +362,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -370,3 +370,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -359,3 +359,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -364,3 +364,4 @@ character-set=latin7
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -359,3 +359,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -371,3 +371,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -359,3 +359,4 @@ character-set=greek
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -361,3 +361,4 @@ character-set=latin2
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -359,3 +359,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -361,3 +361,4 @@ character-set=ujis
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -359,3 +359,4 @@ character-set=euckr
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -361,3 +361,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -361,3 +361,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -363,3 +363,4 @@ character-set=latin2
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -360,3 +360,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -363,3 +363,4 @@ character-set=latin2
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -361,3 +361,4 @@ character-set=koi8r
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> view <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)"
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> view <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>)"
"View '%-.64s.%-.64s' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
"Can't drop a %s from within another stored routine"

View File

@ -365,3 +365,4 @@ character-set=cp1250
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -367,3 +367,4 @@ character-set=latin2
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -361,3 +361,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -359,3 +359,4 @@ character-set=latin1
"View merge algorithm can't be used here for now (assumed undefined algorithm)"
"View being update does not have complete key of underlying table in it"
"View '%-.64s.%-.64s' references invalid table(s) or column(s)"
"Can't drop a %s from within another stored routine"

View File

@ -364,3 +364,4 @@ character-set=koi8u
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> view <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)"
"View, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> ͦ<><CDA6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>æ(<28>), <20><> <20><><EFBFBD><EFBFBD>Ҧ<EFBFBD><D2A6><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
"View '%-.64s.%-.64s' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>Ŧ<EFBFBD><C5A6><EFBFBD><EFBFBD>ަ <20><><EFBFBD><EFBFBD><EFBFBD>æ <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>æ"
"Can't drop a %s from within another stored routine"

View File

@ -5187,6 +5187,11 @@ drop:
| DROP FUNCTION_SYM if_exists sp_name opt_restrict
{
LEX *lex=Lex;
if (lex->sphead)
{
net_printf(YYTHD, ER_SP_NO_DROP_SP, "FUNCTION");
YYABORT;
}
lex->sql_command = SQLCOM_DROP_FUNCTION;
lex->drop_if_exists= $3;
lex->spname= $4;
@ -5194,6 +5199,11 @@ drop:
| DROP PROCEDURE if_exists sp_name opt_restrict
{
LEX *lex=Lex;
if (lex->sphead)
{
net_printf(YYTHD, ER_SP_NO_DROP_SP, "PROCEDURE");
YYABORT;
}
lex->sql_command = SQLCOM_DROP_PROCEDURE;
lex->drop_if_exists= $3;
lex->spname= $4;