drop table if exists t1; create table t1(a integer, b char(10), primary key(a)) engine=ndb; drop procedure if exists myproc1; delimiter $$; create procedure myproc1( in id integer) begin set @stmt = concat("select b from t1 where a = ", id); ##select @stmt; prepare stmt from @stmt; execute stmt; drop prepare stmt; end; $$ delimiter ;$$ drop procedure if exists myproc2; delimiter $$; create procedure myproc2( in id integer, in name char(10)) begin set @stmt = concat("insert into t1 values(",id,",'",name,"')"); ##select @stmt; prepare stmt from @stmt; execute stmt; drop prepare stmt; end; $$ delimiter ;$$ --exec echo "call test.myproc2(1,'johan1');" >$MYSQLTEST_VARDIR/tmp/bug29985 --exec echo "call test.myproc2(2,'johan2');" >>$MYSQLTEST_VARDIR/tmp/bug29985 --exec echo "call test.myproc2(3,'johan3');" >>$MYSQLTEST_VARDIR/tmp/bug29985 --exec echo "call test.myproc2(4,'johan4');" >>$MYSQLTEST_VARDIR/tmp/bug29985 --exec echo "call test.myproc2(5,'johan5');" >>$MYSQLTEST_VARDIR/tmp/bug29985 --exec echo "call test.myproc1(1);" >>$MYSQLTEST_VARDIR/tmp/bug29985 --exec echo "select b from t1 where a = 2" >>$MYSQLTEST_VARDIR/tmp/bug29985 --exec $MYSQL_SLAP --create-schema=test --query=$MYSQLTEST_VARDIR/tmp/bug29985 2>$MYSQLTEST_VARDIR/tmp/bug29985.stderr >$MYSQLTEST_VARDIR/tmp/bug29985.stdout --exec cat $MYSQLTEST_VARDIR/tmp/bug29985.stderr