Below is the list of changes that have just been committed into a local
5.0 repository of andrey. When andrey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-08-24 19:36:26+02:00, andrey@stripped +3 -0
Fix for bug#21416 SP: Recursion level higher than zero needed for non-recursive call
The following procedure was not possible if max_sp_recursion_depth is 0
create procedure show_proc() show create procedure show_proc;
Actually there is no recursive call but the limit is checked.
Solved by temporarily increasing the thread's limit just before the fetch from cache
and decreasing after that.
mysql-test/r/sp.result@stripped, 2006-08-24 19:36:21+02:00, andrey@stripped +7 -0
update result
mysql-test/t/sp.test@stripped, 2006-08-24 19:36:22+02:00, andrey@stripped +10 -0
Test for bug #21416 SP: Recursion level higher than zero needed for non-recursive call
sql/sp.cc@stripped, 2006-08-24 19:36:22+02:00, andrey@stripped +15 -6
Increase the max_sp_recursion_depth temporarily for SHOW CREATE PROCEDURE call.
This call is in fact not recursive but is counted as such. Outcome, it will work
always but if max_sp_recursion_depth is reached we are going to cache one more
sp_head instance.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: andrey
# Host: example.com
# Root: /work/mysql-5.0-runtime
--- 1.209/mysql-test/r/sp.result 2006-08-24 19:36:37 +02:00
+++ 1.210/mysql-test/r/sp.result 2006-08-24 19:36:37 +02:00
@@ -5387,4 +5387,11 @@ BEGIN
RETURN 1;
END|
ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY'
is too long for host name (should be no longer than 60)
+drop procedure if exists bug21416|
+create procedure bug21416() show create procedure bug21416|
+call bug21416()|
+Procedure sql_mode Create Procedure
+bug21416 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`()
+show create procedure bug21416
+drop procedure bug21416|
drop table t1,t2;
--- 1.197/mysql-test/t/sp.test 2006-08-24 19:36:37 +02:00
+++ 1.198/mysql-test/t/sp.test 2006-08-24 19:36:37 +02:00
@@ -6313,6 +6313,16 @@ END|
#
+# BUG#21416: SP: Recursion level higher than zero needed for non-recursive call
+#
+--disable_warnings
+drop procedure if exists bug21416|
+--enable_warnings
+create procedure bug21416() show create procedure bug21416|
+call bug21416()|
+drop procedure bug21416|
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
--- 1.115/sql/sp.cc 2006-08-24 19:36:37 +02:00
+++ 1.116/sql/sp.cc 2006-08-24 19:36:37 +02:00
@@ -1006,6 +1006,12 @@ sp_find_routine(THD *thd, int type, sp_n
}
DBUG_RETURN(sp->m_first_free_instance);
}
+ /*
+ Actually depth could be +1 than the actual value in case a SP calls
+ SHOW CREATE PROCEDURE. Hence, the linked list could hold up to one more
+ instance.
+ */
+
level= sp->m_last_cached_sp->m_recursion_level + 1;
if (level > depth)
{
@@ -1175,19 +1181,22 @@ sp_update_procedure(THD *thd, sp_name *n
int
sp_show_create_procedure(THD *thd, sp_name *name)
{
+ int ret= SP_KEY_NOT_FOUND;
sp_head *sp;
DBUG_ENTER("sp_show_create_procedure");
DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str));
+ /*
+ Increase the recursion limit for this statement. SHOW CREATE PROCEDURE
+ does not do actual recursion.
+ */
+ thd->variables.max_sp_recursion_depth++;
if ((sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
&thd->sp_proc_cache, FALSE)))
- {
- int ret= sp->show_create_procedure(thd);
+ ret= sp->show_create_procedure(thd);
- DBUG_RETURN(ret);
- }
-
- DBUG_RETURN(SP_KEY_NOT_FOUND);
+ thd->variables.max_sp_recursion_depth--;
+ DBUG_RETURN(ret);
}
| Thread |
|---|
| • bk commit into 5.0 tree (andrey:1.2244) BUG#21416 | ahristov | 24 Aug |