From 4467bcf26e0e5f9b205864b5f54f6234c62a2fe3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Jul 2004 17:33:45 +0200 Subject: 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. --- sql/share/czech/errmsg.txt | 1 + sql/share/danish/errmsg.txt | 1 + sql/share/dutch/errmsg.txt | 1 + sql/share/english/errmsg.txt | 1 + sql/share/estonian/errmsg.txt | 1 + sql/share/french/errmsg.txt | 1 + sql/share/german/errmsg.txt | 1 + sql/share/greek/errmsg.txt | 1 + sql/share/hungarian/errmsg.txt | 1 + sql/share/italian/errmsg.txt | 1 + sql/share/japanese/errmsg.txt | 1 + sql/share/korean/errmsg.txt | 1 + sql/share/norwegian-ny/errmsg.txt | 1 + sql/share/norwegian/errmsg.txt | 1 + sql/share/polish/errmsg.txt | 1 + sql/share/portuguese/errmsg.txt | 1 + sql/share/romanian/errmsg.txt | 1 + sql/share/russian/errmsg.txt | 1 + sql/share/serbian/errmsg.txt | 1 + sql/share/slovak/errmsg.txt | 1 + sql/share/spanish/errmsg.txt | 1 + sql/share/swedish/errmsg.txt | 1 + sql/share/ukrainian/errmsg.txt | 1 + sql/sql_yacc.yy | 10 ++++++++++ 24 files changed, 33 insertions(+) (limited to 'sql') diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 9eedbbd9990..b093a3a9091 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -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" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index e9dd993922b..eb7af69f061 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -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" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index d8dde6cba35..0d287daf11e 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -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" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index d6f941d21f7..2e4c5bc0ac4 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -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" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index a23ae3c66fe..821852db13b 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -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" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 3064d2f36a9..f9629485136 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -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" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 30916e682fa..b3e0b2fae05 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -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" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index d87b98cf39b..9a470b81d9e 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -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" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 37fa6a86b49..9e7ea311c2a 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -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" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index c103537d7e2..fc56b72b79f 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -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" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 6783aee5a30..d148fd3f897 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -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" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 472f0d6771d..1e3103c03dd 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -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" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 369b8329397..83ec486f25d 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -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" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 5114b224c0b..8fb651dd2f2 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -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" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 3a45d8fe461..76006c97c5e 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -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" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 58ec02d4bf2..56a95008a2b 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -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" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index c2d67e97e50..f25b81b6577 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -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" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index cf5c9d08582..907cece485f 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -361,3 +361,4 @@ character-set=koi8r "Алгоритм слияния view не может быть использован сейчас (алгоритм будет неопеределенным)" "Обновляемый view не содержит ключа использованной в нем таблиц(ы)" "View '%-.64s.%-.64s' ссылается на несуществующие таблицы или слолбцы" +"Can't drop a %s from within another stored routine" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index eca688cd2ac..cef6fcc1533 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -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" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 89ea0d687cc..4fc4c8808fc 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -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" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 0e2e9180c62..117295b9083 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -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" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index e0ff1f9a52d..bafba304e3a 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -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" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index a050f8e11d0..a043b6eb651 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -364,3 +364,4 @@ character-set=koi8u "Алгоритм зливання view не може бути використаний зараз (алгоритм буде невизначений)" "View, що оновлюеться, не м╕стить повного ключа таблиц╕(ь), що викор╕стана в ньюому" "View '%-.64s.%-.64s' посила╓тся на не╕снуюч╕ таблиц╕ або стовбц╕" +"Can't drop a %s from within another stored routine" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2939090e948..e93f2ac089b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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; -- cgit v1.2.1