#
# 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;

