From: Sergey Petrunia Date: May 3 2008 3:32am Subject: bk commit into 6.0 tree (sergefp:1.2636) BUG#32680 List-Archive: http://lists.mysql.com/commits/46322 X-Bug: 32680 Message-Id: <20080503033220.48C4F22AECE@pslp.localdomain> Below is the list of changes that have just been committed into a local 6.0 repository of sergefp. When sergefp 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, 2008-05-03 07:32:10+04:00, sergefp@stripped +1 -0 BUG#32680: Wrong subselect result (or crash) - Make the range optimizer run only if there is plenty (3*STACK_MIN_SIZE) free space for the stack. - There is no testcase as the problematic query depends on thread-stack setting and doesn't fail with the default. sql/opt_range.cc@stripped, 2008-05-03 07:32:02+04:00, sergefp@stripped +7 -1 BUG#32680: Wrong subselect result (or crash) - Make the range optimizer run only if there is plenty (3*STACK_MIN_SIZE) free space for the stack. diff -Nrup a/sql/opt_range.cc b/sql/opt_range.cc --- a/sql/opt_range.cc 2008-04-25 03:59:32 +04:00 +++ b/sql/opt_range.cc 2008-05-03 07:32:02 +04:00 @@ -2215,7 +2215,13 @@ int SQL_SELECT::test_quick_select(THD *t KEY *key_info; PARAM param; - if (check_stack_overrun(thd, 2*STACK_MIN_SIZE, NULL)) + /* + Use the 3 multiplier as range optimizer allocates big PARAM structure + and may evaluate a subquery expression + TODO During the optimization phase we should evaluate only inexpensive + single-lookup subqueries. + */ + if (check_stack_overrun(thd, 3*STACK_MIN_SIZE, NULL)) DBUG_RETURN(0); // Fatal error flag is set /* set up parameter that is passed to all functions */