List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:February 16 2012 8:52am
Subject:bzr push into mysql-trunk branch (tor.didriksen:3859 to 3860) Bug#33509
View as plain text  
 3860 Tor Didriksen	2012-02-16
      Move test for BUG#33509 to a separate file,
      to avoid tagging all the subquery_sj_xxx tests as experimental.

    added:
      mysql-test/r/bug33509.result
      mysql-test/t/bug33509.test
    modified:
      mysql-test/collections/default.experimental
      mysql-test/include/subquery_sj.inc
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
 3859 Nirbhay Choubey	2012-02-16
      WL#5605 : Assert that MySQL uses an approved random
                number generator
      
      Added support for OpenSSL/yaSSL supplied PRNG to
      create_random_string method, which generates a
      random string to be used in MySQL authentication
      protocol.

    added:
      include/my_rnd.h
      sql/my_rnd.cc
    modified:
      libmysql/CMakeLists.txt
      sql/CMakeLists.txt
      sql/password.c
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2012-02-03 15:16:35 +0000
+++ b/mysql-test/collections/default.experimental	2012-02-16 08:51:53 +0000
@@ -10,39 +10,7 @@ main.mysqlslap @windows                 
 main.signal_demo3 @solaris               # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 main.sp @solaris                         # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 
-main.subquery_sj_all_bka_nixbnl @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_all_bka @solaris                # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_all_bkaunique @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_all @solaris                    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_dupsweed_bka_nixbnl @solaris    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_dupsweed_bka @solaris           # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_dupsweed_bkaunique @solaris     # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_dupsweed @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_firstmatch_bka_nixbnl @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_firstmatch_bka @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_firstmatch_bkaunique @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_firstmatch @solaris             # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_all_bka_nixbnl @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_all_bka @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_all_bkaunique @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_all @solaris             # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_none_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_none_bka @solaris        # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_none_bkaunique @solaris  # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_innodb_none @solaris            # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_loosescan_bka_nixbnl @solaris   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_loosescan_bka @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_loosescan_bkaunique @solaris    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_loosescan @solaris              # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_mat_bka_nixbnl @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_mat_bka @solaris                # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_mat_bkaunique @solaris          # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_mat_nosj @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_mat @solaris                    # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_none_bka_nixbnl @solaris        # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_none_bka @solaris               # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_none_bkaunique @solaris         # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_none @solaris                   # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.bug33509 @solaris                   # Bug#11753919 2012-02-16 didrik Several test cases fail on Solaris with error Thread stack overrun
 
 main.kill @freebsd                       # Bug#12619719 2011-08-04 Occasional failure in PB2
 

=== modified file 'mysql-test/include/subquery_sj.inc'
--- a/mysql-test/include/subquery_sj.inc	2012-01-31 11:19:25 +0000
+++ b/mysql-test/include/subquery_sj.inc	2012-02-16 08:51:53 +0000
@@ -2978,93 +2978,6 @@ drop table t0, t1, t2, t3;
 
 
 #
-# BUG#33509: Server crashes with number of recursive subqueries=61
-#  (the query may or may not fail with an error so we're using it with SP 
-#  
-create table t1 (a int not null);
-
-delimiter |;
-
---disable_warnings
-drop procedure if exists p1|
---enable_warnings
-CREATE PROCEDURE p1()
-BEGIN
-  DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-  prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-  execute s1;
-END;
-|
-delimiter ;|
-
-call p1();
-drop procedure p1;
-drop table t1;
-
-#
 # BUG#35468 "Slowdown and wrong result for uncorrelated subquery w/o where"
 #
 

=== added file 'mysql-test/r/bug33509.result'
--- a/mysql-test/r/bug33509.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug33509.result	2012-02-16 08:51:53 +0000
@@ -0,0 +1,76 @@
+create table t1 (a int not null);
+drop procedure if exists p1|
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
+prepare s1 from '
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( select a from t1) 
+  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
+execute s1;
+END;
+|
+call p1();
+a
+drop procedure p1;
+drop table t1;

=== modified file 'mysql-test/r/subquery_sj_all.result'
--- a/mysql-test/r/subquery_sj_all.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_all.result	2012-02-16 08:51:53 +0000
@@ -5549,82 +5549,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_all_bka.result'
--- a/mysql-test/r/subquery_sj_all_bka.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_all_bka.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_all_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_all_bka_nixbnl.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_all_bka_nixbnl.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_all_bkaunique.result'
--- a/mysql-test/r/subquery_sj_all_bkaunique.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_all_bkaunique.result	2012-02-16 08:51:53 +0000
@@ -5551,82 +5551,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_dupsweed.result'
--- a/mysql-test/r/subquery_sj_dupsweed.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed.result	2012-02-16 08:51:53 +0000
@@ -5548,82 +5548,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka.result	2012-02-16 08:51:53 +0000
@@ -5549,82 +5549,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result	2012-02-16 08:51:53 +0000
@@ -5549,82 +5549,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bkaunique.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_firstmatch.result'
--- a/mysql-test/r/subquery_sj_firstmatch.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch.result	2012-02-16 08:51:53 +0000
@@ -5549,82 +5549,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bkaunique.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2012-02-16 08:51:53 +0000
@@ -5551,82 +5551,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_loosescan.result'
--- a/mysql-test/r/subquery_sj_loosescan.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_loosescan.result	2012-02-16 08:51:53 +0000
@@ -5549,82 +5549,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bka.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bkaunique.result'
--- a/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2012-02-16 08:51:53 +0000
@@ -5551,82 +5551,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_mat.result'
--- a/mysql-test/r/subquery_sj_mat.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_mat.result	2012-02-16 08:51:53 +0000
@@ -5549,82 +5549,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_mat_bka.result'
--- a/mysql-test/r/subquery_sj_mat_bka.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_mat_bka.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_mat_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_mat_bka_nixbnl.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_mat_bka_nixbnl.result	2012-02-16 08:51:53 +0000
@@ -5550,82 +5550,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_mat_bkaunique.result'
--- a/mysql-test/r/subquery_sj_mat_bkaunique.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_mat_bkaunique.result	2012-02-16 08:51:53 +0000
@@ -5551,82 +5551,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_mat_nosj.result'
--- a/mysql-test/r/subquery_sj_mat_nosj.result	2012-02-08 15:25:17 +0000
+++ b/mysql-test/r/subquery_sj_mat_nosj.result	2012-02-16 08:51:53 +0000
@@ -5625,82 +5625,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	SUBQUERY	t3	index	NULL	PRIMARY	4	NULL	10	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_none.result'
--- a/mysql-test/r/subquery_sj_none.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_none.result	2012-02-16 08:51:53 +0000
@@ -5560,82 +5560,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_none_bka.result'
--- a/mysql-test/r/subquery_sj_none_bka.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_none_bka.result	2012-02-16 08:51:53 +0000
@@ -5561,82 +5561,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_none_bka_nixbnl.result'
--- a/mysql-test/r/subquery_sj_none_bka_nixbnl.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_none_bka_nixbnl.result	2012-02-16 08:51:53 +0000
@@ -5561,82 +5561,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== modified file 'mysql-test/r/subquery_sj_none_bkaunique.result'
--- a/mysql-test/r/subquery_sj_none_bkaunique.result	2012-01-31 11:19:25 +0000
+++ b/mysql-test/r/subquery_sj_none_bkaunique.result	2012-02-16 08:51:53 +0000
@@ -5562,82 +5562,6 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	3	Using where; Using join buffer (Block Nested Loop)
 2	DEPENDENT SUBQUERY	t3	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using index
 drop table t0, t1, t2, t3;
-create table t1 (a int not null);
-drop procedure if exists p1|
-CREATE PROCEDURE p1()
-BEGIN
-DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
-prepare s1 from '
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( 
-  select a from t1 where a in ( select a from t1) 
-  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
-execute s1;
-END;
-|
-call p1();
-a
-drop procedure p1;
-drop table t1;
 create table t0 (a int);
 insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a  from t0 A, t0 B, t0 C;

=== added file 'mysql-test/t/bug33509.test'
--- a/mysql-test/t/bug33509.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug33509.test	2012-02-16 08:51:53 +0000
@@ -0,0 +1,87 @@
+#
+# BUG#33509: Server crashes with number of recursive subqueries=61
+#  (the query may or may not fail with an error so we're using it with SP 
+#  
+create table t1 (a int not null);
+
+delimiter |;
+
+--disable_warnings
+drop procedure if exists p1|
+--enable_warnings
+CREATE PROCEDURE p1()
+BEGIN
+  DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
+  prepare s1 from '
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( 
+  select a from t1 where a in ( select a from t1) 
+  )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
+  execute s1;
+END;
+|
+delimiter ;|
+
+call p1();
+drop procedure p1;
+drop table t1;
+

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3859 to 3860) Bug#33509Tor Didriksen16 Feb