List:Commits« Previous MessageNext Message »
From:Akhila Maddukuri Date:July 10 2013 10:52am
Subject:bzr push into mysql-trunk branch (akhila.x.maddukuri:5721 to 5722) WL#5766
View as plain text  
 5722 Akhila Maddukuri	2013-07-10
      WL#5766 : PERFORMANCE SCHEMA, stored programs instrumentation.
            
            Added tests that check stored program instrumentation.

    removed:
      mysql-test/suite/perfschema/r/sub_statement.result
      mysql-test/suite/perfschema/t/sub_statement.test
    added:
      mysql-test/suite/perfschema/include/program_cleanup.inc
      mysql-test/suite/perfschema/include/program_execution.inc
      mysql-test/suite/perfschema/include/program_nested_cleanup.inc
      mysql-test/suite/perfschema/include/program_nested_execution.inc
      mysql-test/suite/perfschema/include/program_nested_setup.inc
      mysql-test/suite/perfschema/include/program_setup.inc
      mysql-test/suite/perfschema/r/statement_program_nested.result
      mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result
      mysql-test/suite/perfschema/r/statement_program_non_nested.result
      mysql-test/suite/perfschema/t/statement_program_nested.test
      mysql-test/suite/perfschema/t/statement_program_nesting_event_check.test
      mysql-test/suite/perfschema/t/statement_program_non_nested.test
    renamed:
      mysql-test/suite/sys_vars/t/pfs_max_routine_instances_basic-master.opt => mysql-test/suite/sys_vars/t/pfs_max_program_instances_basic-master.opt
      mysql-test/suite/sys_vars/t/pfs_statement_stack_size_basic-master.opt => mysql-test/suite/sys_vars/t/pfs_max_statement_stack_basic-master.opt
    modified:
      mysql-test/suite/sys_vars/t/pfs_max_program_instances_basic.test
      mysql-test/suite/sys_vars/t/pfs_max_statement_stack_basic.test
 5721 mayank prasad	2013-06-24
      WL#5766 : PERFORMANCE SCHEMA, stored programs instrumentation.
      
      Details:
       - Final review comments from Marc.

    modified:
      mysql-test/suite/perfschema/r/sizing_default.result
      mysql-test/suite/perfschema/r/sizing_high.result
      mysql-test/suite/perfschema/r/sizing_low.result
      mysql-test/suite/perfschema/r/sizing_med.result
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_program.cc
=== added file 'mysql-test/suite/perfschema/include/program_cleanup.inc'
--- a/mysql-test/suite/perfschema/include/program_cleanup.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/program_cleanup.inc	2013-07-10 08:28:38 +0000
@@ -0,0 +1,26 @@
+#
+# clean up of set-up created in 
+# suite/perfschema/include/program_setup.inc
+#
+
+DROP PROCEDURE SampleProc1;
+DROP PROCEDURE SampleProc2;
+DROP PROCEDURE SampleProc3;
+DROP PROCEDURE SampleProc4;
+
+DROP FUNCTION wt_avg;
+DROP FUNCTION fac;
+DROP FUNCTION append;
+
+DROP TRIGGER trg1;
+DROP TRIGGER trg2;
+DROP TRIGGER trg3;
+DROP TRIGGER trg4;
+DROP TRIGGER trg5;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+
+DROP DATABASE stored_programs;

=== added file 'mysql-test/suite/perfschema/include/program_execution.inc'
--- a/mysql-test/suite/perfschema/include/program_execution.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/program_execution.inc	2013-07-10 08:28:38 +0000
@@ -0,0 +1,27 @@
+#
+# Execute the stored programs created in 
+# suite/perfschema/include/program_setup.inc 
+#
+
+--echo #####################
+--echo # Executing queries #
+--echo #####################
+INSERT INTO t1 VALUES (10,20);
+CALL SampleProc1(30,40,50);
+SET @a=1;
+SELECT @a;
+CALL SampleProc2("Jwalamukhi",34);
+SELECT @a;
+CALL SampleProc3();
+CALL SampleProc4();
+SET @change=1;
+SELECT @change;
+UPDATE t2 SET id=22 WHERE name="Jwalamukhi";
+SELECT @change;
+SET @del=1;
+SELECT @del;
+DELETE FROM t1 WHERE i=40;
+SELECT @del;
+SELECT wt_avg(1, 12, 1990, 1121990);
+SELECT fac(5);
+SELECT append("Bolly", "wood");

=== added file 'mysql-test/suite/perfschema/include/program_nested_cleanup.inc'
--- a/mysql-test/suite/perfschema/include/program_nested_cleanup.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/program_nested_cleanup.inc	2013-07-10 08:28:38 +0000
@@ -0,0 +1,21 @@
+#
+# clean up if set-up created in
+# suite/perfschema/include/program_nested_setup.inc
+#
+
+DROP PROCEDURE c4;
+DROP PROCEDURE c3;
+DROP PROCEDURE c2;
+DROP PROCEDURE c1;
+DROP PROCEDURE inc;
+DROP PROCEDURE inc2;
+DROP PROCEDURE iotest;
+DROP FUNCTION mul;
+DROP FUNCTION inc;
+DROP FUNCTION fac;
+DROP FUNCTION fun;
+DROP PROCEDURE ifac;
+DROP TRIGGER trg;
+DROP TABLE t1,t2;
+
+DROP DATABASE nested_sp;

=== added file 'mysql-test/suite/perfschema/include/program_nested_execution.inc'
--- a/mysql-test/suite/perfschema/include/program_nested_execution.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/program_nested_execution.inc	2013-07-10 08:28:38 +0000
@@ -0,0 +1,22 @@
+#
+# Execute the nested stored programs created in
+# suite/include/perfschema/program_nested_setup.inc 
+#
+
+--echo #####################
+--echo # Executing queries #
+--echo #####################
+
+CALL c1(42);
+SELECT * FROM t1;
+DELETE FROM t1;
+
+CALL iotest("io1", "io2", 1);
+SELECT * FROM t1 ORDER BY data DESC;
+DELETE FROM t1;
+
+SELECT fun(6,10);
+
+INSERT INTO t1 VALUES (20,13);
+
+SELECT * FROM t2;

=== added file 'mysql-test/suite/perfschema/include/program_nested_setup.inc'
--- a/mysql-test/suite/perfschema/include/program_nested_setup.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/program_nested_setup.inc	2013-07-10 08:28:38 +0000
@@ -0,0 +1,85 @@
+#
+# SET-UP - Creation of various nested stored programs
+#
+
+--echo # SET-UP
+CREATE DATABASE nested_sp;
+USE nested_sp;
+
+CREATE TABLE t1(
+        id   CHAR(16) NOT NULL DEFAULT '',
+        data INT NOT NULL
+);
+
+CREATE TABLE t2(
+  n INT UNSIGNED NOT NULL, 
+  f BIGINT UNSIGNED
+);
+
+--echo ############################
+--echo # Creating Stored Programs #
+--echo ############################
+DELIMITER |;
+
+# Nested Stored Procedure - 1
+CREATE PROCEDURE c1(x INT)
+  CALL c2("c", x)|
+CREATE PROCEDURE c2(s CHAR(16), x INT)
+  CALL c3(x, s)|
+CREATE PROCEDURE c3(x INT, s CHAR(16))
+  CALL c4("level", x, s)|
+CREATE PROCEDURE c4(l CHAR(8), x INT, s CHAR(16))
+  INSERT INTO t1 VALUES (concat(l,s), x)|
+
+# Nested Stored Procedure - 2
+CREATE PROCEDURE iotest(x1 CHAR(16), x2 CHAR(16), y INT)
+BEGIN
+  CALL inc2(x2, y);
+  INSERT INTO t1 VALUES (x1, y);
+END|
+CREATE PROCEDURE inc2(x CHAR(16), y INT)
+BEGIN
+  CALL inc(y);
+  INSERT INTO t1 VALUES (x, y);
+END|
+CREATE PROCEDURE inc(inout io INT)
+  SET io = io + 1|
+
+# Nested Stored Function 
+CREATE FUNCTION mul(x INT, y INT) RETURNS INT
+  RETURN x*y|
+CREATE FUNCTION inc(i INT) RETURNS INT
+  RETURN i+1|
+CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
+BEGIN
+  DECLARE f BIGINT UNSIGNED DEFAULT 1;
+  WHILE n > 1 DO
+    SET f = f * n;
+    SET n = n - 1;
+  END WHILE;
+  RETURN f;
+END|
+CREATE FUNCTION fun(i INT, u INT UNSIGNED) RETURNS DOUBLE
+  RETURN mul(inc(i), fac(u))|
+#
+# A nested stored program 
+#
+CREATE PROCEDURE ifac(n INT UNSIGNED)
+BEGIN
+  DECLARE i BIGINT UNSIGNED DEFAULT 1;
+
+  IF n > 20 THEN
+    SET n = 20;         # bigint overflow otherwise
+  END IF;
+  WHILE i <= n DO
+    BEGIN
+      INSERT INTO t2 VALUES (i, fac(i));
+      SET i = i + 1;
+    END;
+  END WHILE;
+END|
+CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW
+  CALL ifac(10)|
+
+DELIMITER ;|
+

=== added file 'mysql-test/suite/perfschema/include/program_setup.inc'
--- a/mysql-test/suite/perfschema/include/program_setup.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/include/program_setup.inc	2013-07-10 08:28:38 +0000
@@ -0,0 +1,136 @@
+#
+# SET-UP - Creation of various non-nested stored programs 
+#
+
+--echo # SET-UP 
+
+CREATE DATABASE stored_programs;
+USE stored_programs;
+
+CREATE TABLE t1(
+   i INT NOT NULL,
+   j INT
+);
+
+CREATE TABLE t2(
+   name   CHAR(16) NOT NULL DEFAULT '',
+   id INT NOT NULL
+);
+
+CREATE TABLE t3(
+   d DATE,
+   n INT,
+   f DOUBLE,
+   s VARCHAR(32)
+);
+
+CREATE TABLE t4(
+   `k` int(10) unsigned NOT NULL AUTO_INCREMENT,
+   `word` varchar(100) NOT NULL,
+   `mean` varchar(300) NOT NULL,
+   PRIMARY KEY (`k`)
+);
+
+
+--echo ############################
+--echo # Creating Stored Programs #
+--echo ############################
+
+--echo # Stored Routine ( Procedure & Function )
+
+DELIMITER |;
+CREATE PROCEDURE SampleProc1(x1 INT, x2 INT, y INT)
+BEGIN
+  INSERT INTO t1 VALUES (x1, y);
+  INSERT INTO t1 VALUES (x2, y);
+END|
+
+CREATE PROCEDURE SampleProc2(x CHAR(16), y INT)
+BEGIN
+  DECLARE z1, z2 INT;
+  SET z1 = y;
+  SET z2 = z1+2;
+  INSERT INTO t2 VALUES (x, z2);
+END|
+
+CREATE PROCEDURE SampleProc3()
+BEGIN
+  DECLARE ld DATE;
+  DECLARE li INT;
+  DECLARE lf DOUBLE;
+  DECLARE ls VARCHAR(32);
+
+  SET ld = NULL, li = NULL, lf = NULL, ls = NULL;
+  INSERT INTO t3 VALUES (ld, li, lf, ls);
+
+  INSERT INTO t3 (n, f, s) VALUES ((ld IS NULL), 1,    "ld is null"),
+                                  ((li IS NULL), 1,    "li is null"),
+                                  ((li = 0),     NULL, "li = 0"),
+                                  ((lf IS NULL), 1,    "lf is null"),
+                                  ((lf = 0),     NULL, "lf = 0"),
+                                  ((ls IS NULL), 1,    "ls is null");
+END|
+
+ 
+CREATE PROCEDURE SampleProc4()
+BEGIN
+               DECLARE x  INT;
+               SET x = 1;
+               WHILE x  <= 2 DO
+                   INSERT INTO t4(word, mean) VALUES('a','a mean');
+                   SET  x = x + 1;
+               END WHILE;
+END|
+
+CREATE FUNCTION append(s1 CHAR(8), s2 CHAR(8)) RETURNS CHAR(16)
+  RETURN concat(s1, s2)|
+
+CREATE FUNCTION wt_avg(n1 INT, n2 INT, n3 INT, n4 INT)
+  RETURNS INT
+   DETERMINISTIC
+    BEGIN
+     DECLARE avg INT;
+     SET avg = (n1+n2+n3*2+n4*4)/8;
+     RETURN avg;
+    END|
+
+CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
+BEGIN
+  DECLARE f BIGINT UNSIGNED DEFAULT 1;
+  WHILE n > 1 DO
+    SET f = f * n;
+    SET n = n - 1;
+  END WHILE;
+  RETURN f;
+END|
+
+--echo # Triggers
+
+# INSERT triggers
+CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+  if isnull(new.j) then
+    SET new.j:= new.i * 10;
+  END if;
+END|
+
+CREATE TRIGGER trg2 AFTER INSERT ON t2 FOR EACH ROW
+BEGIN
+  UPDATE t1 SET i=new.id+i ;
+END|
+
+# UPDATE trigger
+CREATE TRIGGER trg3 AFTER UPDATE ON t2 FOR EACH ROW
+  SET @change:= @change + new.id - old.id|
+
+# DELETE triggers
+CREATE TRIGGER trg4 BEFORE DELETE ON t1 FOR EACH ROW
+  SET @del:= @del + old.j|
+
+CREATE TRIGGER trg5 AFTER DELETE ON t1 FOR EACH ROW 
+  SET @del:= 1|
+
+--echo # Events 
+# add events here - will be added by mayank
+
+DELIMITER ;|

=== added file 'mysql-test/suite/perfschema/r/statement_program_nested.result'
--- a/mysql-test/suite/perfschema/r/statement_program_nested.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/statement_program_nested.result	2013-07-10 08:28:38 +0000
@@ -0,0 +1,1206 @@
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+###########################################
+# Quering PS statement summary and history #
+###########################################
+# SET-UP
+CREATE DATABASE nested_sp;
+USE nested_sp;
+CREATE TABLE t1(
+id   CHAR(16) NOT NULL DEFAULT '',
+data INT NOT NULL
+);
+CREATE TABLE t2(
+n INT UNSIGNED NOT NULL, 
+f BIGINT UNSIGNED
+);
+############################
+# Creating Stored Programs #
+############################
+CREATE PROCEDURE c1(x INT)
+CALL c2("c", x)|
+CREATE PROCEDURE c2(s CHAR(16), x INT)
+CALL c3(x, s)|
+CREATE PROCEDURE c3(x INT, s CHAR(16))
+CALL c4("level", x, s)|
+CREATE PROCEDURE c4(l CHAR(8), x INT, s CHAR(16))
+INSERT INTO t1 VALUES (concat(l,s), x)|
+CREATE PROCEDURE iotest(x1 CHAR(16), x2 CHAR(16), y INT)
+BEGIN
+CALL inc2(x2, y);
+INSERT INTO t1 VALUES (x1, y);
+END|
+CREATE PROCEDURE inc2(x CHAR(16), y INT)
+BEGIN
+CALL inc(y);
+INSERT INTO t1 VALUES (x, y);
+END|
+CREATE PROCEDURE inc(inout io INT)
+SET io = io + 1|
+CREATE FUNCTION mul(x INT, y INT) RETURNS INT
+RETURN x*y|
+CREATE FUNCTION inc(i INT) RETURNS INT
+RETURN i+1|
+CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
+BEGIN
+DECLARE f BIGINT UNSIGNED DEFAULT 1;
+WHILE n > 1 DO
+SET f = f * n;
+SET n = n - 1;
+END WHILE;
+RETURN f;
+END|
+CREATE FUNCTION fun(i INT, u INT UNSIGNED) RETURNS DOUBLE
+RETURN mul(inc(i), fac(u))|
+CREATE PROCEDURE ifac(n INT UNSIGNED)
+BEGIN
+DECLARE i BIGINT UNSIGNED DEFAULT 1;
+IF n > 20 THEN
+SET n = 20;         # bigint overflow otherwise
+END IF;
+WHILE i <= n DO
+BEGIN
+INSERT INTO t2 VALUES (i, fac(i));
+SET i = i + 1;
+END;
+END WHILE;
+END|
+CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW
+CALL ifac(10)|
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='nested_sp';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+PROCEDURE	nested_sp	c1	0	0
+PROCEDURE	nested_sp	c2	0	0
+PROCEDURE	nested_sp	c3	0	0
+PROCEDURE	nested_sp	c4	0	0
+PROCEDURE	nested_sp	iotest	0	0
+PROCEDURE	nested_sp	inc2	0	0
+PROCEDURE	nested_sp	inc	0	0
+FUNCTION	nested_sp	mul	0	0
+FUNCTION	nested_sp	inc	0	0
+FUNCTION	nested_sp	fac	0	0
+FUNCTION	nested_sp	fun	0	0
+PROCEDURE	nested_sp	ifac	0	0
+#####################
+# Executing queries #
+#####################
+CALL c1(42);
+SELECT * FROM t1;
+id	data
+levelc	42
+DELETE FROM t1;
+CALL iotest("io1", "io2", 1);
+SELECT * FROM t1 ORDER BY data DESC;
+id	data
+io2	2
+io1	1
+DELETE FROM t1;
+SELECT fun(6,10);
+fun(6,10)
+25401600
+INSERT INTO t1 VALUES (20,13);
+SELECT * FROM t2;
+n	f
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+SELECT EVENT_NAME, SQL_TEXT, CURRENT_SCHEMA, OBJECT_TYPE, OBJECT_SCHEMA,
+OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL 
+FROM performance_schema.events_statements_history_long WHERE
+CURRENT_SCHEMA='nested_sp';
+EVENT_NAME	SQL_TEXT	CURRENT_SCHEMA	OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/stmt	CALL ifac(10)	nested_sp	TRIGGER	nested_sp	trg	STATEMENT	1
+statement/sql/insert	INSERT INTO t1 VALUES (20,13)	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT * FROM t2	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	7
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	6
+statement/sp/stmt	CALL ifac(10)	nested_sp	TRIGGER	nested_sp	trg	STATEMENT	5
+statement/sp/stmt	INSERT INTO t1 VALUES (concat(l,s), x)	nested_sp	PROCEDURE	nested_sp	c4	STATEMENT	4
+statement/sp/stmt	CALL c4("level", x, s)	nested_sp	PROCEDURE	nested_sp	c3	STATEMENT	3
+statement/sp/stmt	CALL c3(x, s)	nested_sp	PROCEDURE	nested_sp	c2	STATEMENT	2
+statement/sp/stmt	CALL c2("c", x)	nested_sp	PROCEDURE	nested_sp	c1	STATEMENT	1
+statement/sql/call_procedure	CALL c1(42)	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT * FROM t1	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sql/delete	DELETE FROM t1	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	inc	STATEMENT	3
+statement/sp/stmt	CALL inc(y)	nested_sp	PROCEDURE	nested_sp	inc2	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	5
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	4
+statement/sp/stmt	CALL ifac(10)	nested_sp	TRIGGER	nested_sp	trg	STATEMENT	3
+statement/sp/stmt	INSERT INTO t1 VALUES (x, y)	nested_sp	PROCEDURE	nested_sp	inc2	STATEMENT	2
+statement/sp/stmt	CALL inc2(x2, y)	nested_sp	PROCEDURE	nested_sp	iotest	STATEMENT	1
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	4
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	3
+statement/sp/stmt	CALL ifac(10)	nested_sp	TRIGGER	nested_sp	trg	STATEMENT	2
+statement/sp/stmt	INSERT INTO t1 VALUES (x1, y)	nested_sp	PROCEDURE	nested_sp	iotest	STATEMENT	1
+statement/sql/call_procedure	CALL iotest("io1", "io2", 1)	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT * FROM t1 ORDER BY data DESC	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sql/delete	DELETE FROM t1	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	inc	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	2
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	mul	STATEMENT	2
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fun	STATEMENT	1
+statement/sql/select	SELECT fun(6,10)	nested_sp	NULL	NULL	NULL	NULL	0
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/freturn	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/stmt	INSERT INTO t2 VALUES (i, fac(i))	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/jump_if_not	NULL	nested_sp	PROCEDURE	nested_sp	ifac	STATEMENT	2
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump_if_not	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/set	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+statement/sp/jump	NULL	nested_sp	FUNCTION	nested_sp	fac	STATEMENT	3
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='nested_sp';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+PROCEDURE	nested_sp	c1	1	1
+PROCEDURE	nested_sp	c2	1	1
+PROCEDURE	nested_sp	c3	1	1
+PROCEDURE	nested_sp	c4	1	1
+PROCEDURE	nested_sp	iotest	1	2
+PROCEDURE	nested_sp	inc2	1	2
+PROCEDURE	nested_sp	inc	1	1
+FUNCTION	nested_sp	mul	1	1
+FUNCTION	nested_sp	inc	1	1
+FUNCTION	nested_sp	fac	41	879
+FUNCTION	nested_sp	fun	1	1
+PROCEDURE	nested_sp	ifac	4	172
+TRIGGER	nested_sp	trg	4	4
+# clean-up
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='nested_sp';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+PROCEDURE	nested_sp	c1	0	0
+PROCEDURE	nested_sp	c2	0	0
+PROCEDURE	nested_sp	c3	0	0
+PROCEDURE	nested_sp	c4	0	0
+PROCEDURE	nested_sp	iotest	0	0
+PROCEDURE	nested_sp	inc2	0	0
+PROCEDURE	nested_sp	inc	0	0
+FUNCTION	nested_sp	mul	0	0
+FUNCTION	nested_sp	inc	0	0
+FUNCTION	nested_sp	fac	0	0
+FUNCTION	nested_sp	fun	0	0
+PROCEDURE	nested_sp	ifac	0	0
+TRIGGER	nested_sp	trg	0	0
+DROP PROCEDURE c4;
+DROP PROCEDURE c3;
+DROP PROCEDURE c2;
+DROP PROCEDURE c1;
+DROP PROCEDURE inc;
+DROP PROCEDURE inc2;
+DROP PROCEDURE iotest;
+DROP FUNCTION mul;
+DROP FUNCTION inc;
+DROP FUNCTION fac;
+DROP FUNCTION fun;
+DROP PROCEDURE ifac;
+DROP TRIGGER trg;
+DROP TABLE t1,t2;
+DROP DATABASE nested_sp;
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='nested_sp';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS

=== added file 'mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result'
--- a/mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/statement_program_nesting_event_check.result	2013-07-10 08:28:38 +0000
@@ -0,0 +1,1444 @@
+TRUNCATE TABLE performance_schema.events_statements_history;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+TRUNCATE TABLE performance_schema.events_statements_current;
+# SET-UP 
+CREATE DATABASE stored_programs;
+USE stored_programs;
+CREATE TABLE t1(
+i INT NOT NULL,
+j INT
+);
+CREATE TABLE t2(
+name   CHAR(16) NOT NULL DEFAULT '',
+id INT NOT NULL
+);
+CREATE TABLE t3(
+d DATE,
+n INT,
+f DOUBLE,
+s VARCHAR(32)
+);
+CREATE TABLE t4(
+`k` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`word` varchar(100) NOT NULL,
+`mean` varchar(300) NOT NULL,
+PRIMARY KEY (`k`)
+);
+############################
+# Creating Stored Programs #
+############################
+# Stored Routine ( Procedure & Function )
+CREATE PROCEDURE SampleProc1(x1 INT, x2 INT, y INT)
+BEGIN
+INSERT INTO t1 VALUES (x1, y);
+INSERT INTO t1 VALUES (x2, y);
+END|
+CREATE PROCEDURE SampleProc2(x CHAR(16), y INT)
+BEGIN
+DECLARE z1, z2 INT;
+SET z1 = y;
+SET z2 = z1+2;
+INSERT INTO t2 VALUES (x, z2);
+END|
+CREATE PROCEDURE SampleProc3()
+BEGIN
+DECLARE ld DATE;
+DECLARE li INT;
+DECLARE lf DOUBLE;
+DECLARE ls VARCHAR(32);
+SET ld = NULL, li = NULL, lf = NULL, ls = NULL;
+INSERT INTO t3 VALUES (ld, li, lf, ls);
+INSERT INTO t3 (n, f, s) VALUES ((ld IS NULL), 1,    "ld is null"),
+((li IS NULL), 1,    "li is null"),
+((li = 0),     NULL, "li = 0"),
+((lf IS NULL), 1,    "lf is null"),
+((lf = 0),     NULL, "lf = 0"),
+((ls IS NULL), 1,    "ls is null");
+END|
+CREATE PROCEDURE SampleProc4()
+BEGIN
+DECLARE x  INT;
+SET x = 1;
+WHILE x  <= 2 DO
+INSERT INTO t4(word, mean) VALUES('a','a mean');
+SET  x = x + 1;
+END WHILE;
+END|
+CREATE FUNCTION append(s1 CHAR(8), s2 CHAR(8)) RETURNS CHAR(16)
+RETURN concat(s1, s2)|
+CREATE FUNCTION wt_avg(n1 INT, n2 INT, n3 INT, n4 INT)
+RETURNS INT
+DETERMINISTIC
+BEGIN
+DECLARE avg INT;
+SET avg = (n1+n2+n3*2+n4*4)/8;
+RETURN avg;
+END|
+CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
+BEGIN
+DECLARE f BIGINT UNSIGNED DEFAULT 1;
+WHILE n > 1 DO
+SET f = f * n;
+SET n = n - 1;
+END WHILE;
+RETURN f;
+END|
+# Triggers
+CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+if isnull(new.j) then
+SET new.j:= new.i * 10;
+END if;
+END|
+CREATE TRIGGER trg2 AFTER INSERT ON t2 FOR EACH ROW
+BEGIN
+UPDATE t1 SET i=new.id+i ;
+END|
+CREATE TRIGGER trg3 AFTER UPDATE ON t2 FOR EACH ROW
+SET @change:= @change + new.id - old.id|
+CREATE TRIGGER trg4 BEFORE DELETE ON t1 FOR EACH ROW
+SET @del:= @del + old.j|
+CREATE TRIGGER trg5 AFTER DELETE ON t1 FOR EACH ROW 
+SET @del:= 1|
+# Events 
+#####################
+# Executing queries #
+#####################
+INSERT INTO t1 VALUES (10,20);
+CALL SampleProc1(30,40,50);
+SET @a=1;
+SELECT @a;
+@a
+1
+CALL SampleProc2("Jwalamukhi",34);
+SELECT @a;
+@a
+1
+CALL SampleProc3();
+CALL SampleProc4();
+SET @change=1;
+SELECT @change;
+@change
+1
+UPDATE t2 SET id=22 WHERE name="Jwalamukhi";
+SELECT @change;
+@change
+-13
+SET @del=1;
+SELECT @del;
+@del
+1
+DELETE FROM t1 WHERE i=40;
+SELECT @del;
+@del
+1
+SELECT wt_avg(1, 12, 1990, 1121990);
+wt_avg(1, 12, 1990, 1121990)
+561494
+SELECT fac(5);
+fac(5)
+120
+SELECT append("Bolly", "wood");
+append("Bolly", "wood")
+Bollywood
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+FROM performance_schema.events_statements_current WHERE
+CURRENT_SCHEMA='stored_programs';
+EVENT_NAME	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sql/select	NULL	NULL	0
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+FROM performance_schema.events_statements_history WHERE
+CURRENT_SCHEMA='stored_programs';
+EVENT_NAME	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sp/jump	fac	STATEMENT	1
+statement/sp/jump_if_not	fac	STATEMENT	1
+statement/sp/freturn	fac	STATEMENT	1
+statement/sql/select	NULL	NULL	0
+statement/sp/freturn	append	STATEMENT	1
+statement/sql/select	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sp/jump_if_not	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+FROM performance_schema.events_statements_history_long WHERE
+CURRENT_SCHEMA='stored_programs';
+EVENT_NAME	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sql/create_table	NULL	NULL	0
+statement/sql/create_table	NULL	NULL	0
+statement/sql/create_table	NULL	NULL	0
+statement/sql/create_table	NULL	NULL	0
+statement/sql/create_procedure	NULL	NULL	0
+statement/sql/create_procedure	NULL	NULL	0
+statement/sql/create_procedure	NULL	NULL	0
+statement/sql/create_procedure	NULL	NULL	0
+statement/sql/create_function	NULL	NULL	0
+statement/sql/create_function	NULL	NULL	0
+statement/sql/create_function	NULL	NULL	0
+statement/sql/create_trigger	NULL	NULL	0
+statement/sql/create_trigger	NULL	NULL	0
+statement/sql/create_trigger	NULL	NULL	0
+statement/sql/create_trigger	NULL	NULL	0
+statement/sql/create_trigger	NULL	NULL	0
+statement/sp/jump_if_not	trg1	STATEMENT	1
+statement/sql/insert	NULL	NULL	0
+statement/sp/jump_if_not	trg1	STATEMENT	2
+statement/sp/stmt	SampleProc1	STATEMENT	1
+statement/sp/jump_if_not	trg1	STATEMENT	2
+statement/sp/stmt	SampleProc1	STATEMENT	1
+statement/sql/call_procedure	NULL	NULL	0
+statement/sql/set_option	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sp/set	SampleProc2	STATEMENT	1
+statement/sp/set	SampleProc2	STATEMENT	1
+statement/sp/set	SampleProc2	STATEMENT	1
+statement/sp/set	SampleProc2	STATEMENT	1
+statement/sp/stmt	trg2	STATEMENT	2
+statement/sp/stmt	SampleProc2	STATEMENT	1
+statement/sql/call_procedure	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/set	SampleProc3	STATEMENT	1
+statement/sp/stmt	SampleProc3	STATEMENT	1
+statement/sp/stmt	SampleProc3	STATEMENT	1
+statement/sql/call_procedure	NULL	NULL	0
+statement/sp/set	SampleProc4	STATEMENT	1
+statement/sp/set	SampleProc4	STATEMENT	1
+statement/sp/jump_if_not	SampleProc4	STATEMENT	1
+statement/sp/stmt	SampleProc4	STATEMENT	1
+statement/sp/set	SampleProc4	STATEMENT	1
+statement/sp/jump	SampleProc4	STATEMENT	1
+statement/sp/jump_if_not	SampleProc4	STATEMENT	1
+statement/sp/stmt	SampleProc4	STATEMENT	1
+statement/sp/set	SampleProc4	STATEMENT	1
+statement/sp/jump	SampleProc4	STATEMENT	1
+statement/sp/jump_if_not	SampleProc4	STATEMENT	1
+statement/sql/call_procedure	NULL	NULL	0
+statement/sql/set_option	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sp/stmt	trg3	STATEMENT	1
+statement/sql/update	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/set_option	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/delete	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sp/set	wt_avg	STATEMENT	1
+statement/sp/set	wt_avg	STATEMENT	1
+statement/sp/freturn	wt_avg	STATEMENT	1
+statement/sql/select	NULL	NULL	0
+statement/sp/set	fac	STATEMENT	1
+statement/sp/jump_if_not	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/jump	fac	STATEMENT	1
+statement/sp/jump_if_not	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/jump	fac	STATEMENT	1
+statement/sp/jump_if_not	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/jump	fac	STATEMENT	1
+statement/sp/jump_if_not	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/set	fac	STATEMENT	1
+statement/sp/jump	fac	STATEMENT	1
+statement/sp/jump_if_not	fac	STATEMENT	1
+statement/sp/freturn	fac	STATEMENT	1
+statement/sql/select	NULL	NULL	0
+statement/sp/freturn	append	STATEMENT	1
+statement/sql/select	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+TRUNCATE TABLE performance_schema.events_statements_history;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+TRUNCATE TABLE performance_schema.events_statements_current;
+DROP PROCEDURE SampleProc1;
+DROP PROCEDURE SampleProc2;
+DROP PROCEDURE SampleProc3;
+DROP PROCEDURE SampleProc4;
+DROP FUNCTION wt_avg;
+DROP FUNCTION fac;
+DROP FUNCTION append;
+DROP TRIGGER trg1;
+DROP TRIGGER trg2;
+DROP TRIGGER trg3;
+DROP TRIGGER trg4;
+DROP TRIGGER trg5;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP DATABASE stored_programs;
+# SET-UP
+CREATE DATABASE nested_sp;
+USE nested_sp;
+CREATE TABLE t1(
+id   CHAR(16) NOT NULL DEFAULT '',
+data INT NOT NULL
+);
+CREATE TABLE t2(
+n INT UNSIGNED NOT NULL, 
+f BIGINT UNSIGNED
+);
+############################
+# Creating Stored Programs #
+############################
+CREATE PROCEDURE c1(x INT)
+CALL c2("c", x)|
+CREATE PROCEDURE c2(s CHAR(16), x INT)
+CALL c3(x, s)|
+CREATE PROCEDURE c3(x INT, s CHAR(16))
+CALL c4("level", x, s)|
+CREATE PROCEDURE c4(l CHAR(8), x INT, s CHAR(16))
+INSERT INTO t1 VALUES (concat(l,s), x)|
+CREATE PROCEDURE iotest(x1 CHAR(16), x2 CHAR(16), y INT)
+BEGIN
+CALL inc2(x2, y);
+INSERT INTO t1 VALUES (x1, y);
+END|
+CREATE PROCEDURE inc2(x CHAR(16), y INT)
+BEGIN
+CALL inc(y);
+INSERT INTO t1 VALUES (x, y);
+END|
+CREATE PROCEDURE inc(inout io INT)
+SET io = io + 1|
+CREATE FUNCTION mul(x INT, y INT) RETURNS INT
+RETURN x*y|
+CREATE FUNCTION inc(i INT) RETURNS INT
+RETURN i+1|
+CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
+BEGIN
+DECLARE f BIGINT UNSIGNED DEFAULT 1;
+WHILE n > 1 DO
+SET f = f * n;
+SET n = n - 1;
+END WHILE;
+RETURN f;
+END|
+CREATE FUNCTION fun(i INT, u INT UNSIGNED) RETURNS DOUBLE
+RETURN mul(inc(i), fac(u))|
+CREATE PROCEDURE ifac(n INT UNSIGNED)
+BEGIN
+DECLARE i BIGINT UNSIGNED DEFAULT 1;
+IF n > 20 THEN
+SET n = 20;         # bigint overflow otherwise
+END IF;
+WHILE i <= n DO
+BEGIN
+INSERT INTO t2 VALUES (i, fac(i));
+SET i = i + 1;
+END;
+END WHILE;
+END|
+CREATE TRIGGER trg AFTER INSERT ON t1 FOR EACH ROW
+CALL ifac(10)|
+#####################
+# Executing queries #
+#####################
+CALL c1(42);
+SELECT * FROM t1;
+id	data
+levelc	42
+DELETE FROM t1;
+CALL iotest("io1", "io2", 1);
+SELECT * FROM t1 ORDER BY data DESC;
+id	data
+io2	2
+io1	1
+DELETE FROM t1;
+SELECT fun(6,10);
+fun(6,10)
+25401600
+INSERT INTO t1 VALUES (20,13);
+SELECT * FROM t2;
+n	f
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+1	1
+2	2
+3	6
+4	24
+5	120
+6	720
+7	5040
+8	40320
+9	362880
+10	3628800
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+FROM performance_schema.events_statements_current WHERE
+CURRENT_SCHEMA='nested_sp';
+EVENT_NAME	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sql/select	NULL	NULL	0
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+FROM performance_schema.events_statements_history WHERE
+CURRENT_SCHEMA='nested_sp';
+EVENT_NAME	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sp/stmt	trg	STATEMENT	1
+statement/sql/insert	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+FROM performance_schema.events_statements_history_long WHERE
+CURRENT_SCHEMA='nested_sp';
+EVENT_NAME	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/stmt	trg	STATEMENT	1
+statement/sql/insert	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/freturn	fac	STATEMENT	7
+statement/sp/stmt	ifac	STATEMENT	6
+statement/sp/set	ifac	STATEMENT	6
+statement/sp/jump	ifac	STATEMENT	6
+statement/sp/jump_if_not	ifac	STATEMENT	6
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/freturn	fac	STATEMENT	7
+statement/sp/stmt	ifac	STATEMENT	6
+statement/sp/set	ifac	STATEMENT	6
+statement/sp/jump	ifac	STATEMENT	6
+statement/sp/jump_if_not	ifac	STATEMENT	6
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/freturn	fac	STATEMENT	7
+statement/sp/stmt	ifac	STATEMENT	6
+statement/sp/set	ifac	STATEMENT	6
+statement/sp/jump	ifac	STATEMENT	6
+statement/sp/jump_if_not	ifac	STATEMENT	6
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/freturn	fac	STATEMENT	7
+statement/sp/stmt	ifac	STATEMENT	6
+statement/sp/set	ifac	STATEMENT	6
+statement/sp/jump	ifac	STATEMENT	6
+statement/sp/jump_if_not	ifac	STATEMENT	6
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/set	fac	STATEMENT	7
+statement/sp/jump	fac	STATEMENT	7
+statement/sp/jump_if_not	fac	STATEMENT	7
+statement/sp/freturn	fac	STATEMENT	7
+statement/sp/stmt	ifac	STATEMENT	6
+statement/sp/set	ifac	STATEMENT	6
+statement/sp/jump	ifac	STATEMENT	6
+statement/sp/jump_if_not	ifac	STATEMENT	6
+statement/sp/stmt	trg	STATEMENT	5
+statement/sp/stmt	c4	STATEMENT	4
+statement/sp/stmt	c3	STATEMENT	3
+statement/sp/stmt	c2	STATEMENT	2
+statement/sp/stmt	c1	STATEMENT	1
+statement/sql/call_procedure	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/delete	NULL	NULL	0
+statement/sp/set	inc	STATEMENT	3
+statement/sp/stmt	inc2	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/set	fac	STATEMENT	5
+statement/sp/jump	fac	STATEMENT	5
+statement/sp/jump_if_not	fac	STATEMENT	5
+statement/sp/freturn	fac	STATEMENT	5
+statement/sp/stmt	ifac	STATEMENT	4
+statement/sp/set	ifac	STATEMENT	4
+statement/sp/jump	ifac	STATEMENT	4
+statement/sp/jump_if_not	ifac	STATEMENT	4
+statement/sp/stmt	trg	STATEMENT	3
+statement/sp/stmt	inc2	STATEMENT	2
+statement/sp/stmt	iotest	STATEMENT	1
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/set	fac	STATEMENT	4
+statement/sp/jump	fac	STATEMENT	4
+statement/sp/jump_if_not	fac	STATEMENT	4
+statement/sp/freturn	fac	STATEMENT	4
+statement/sp/stmt	ifac	STATEMENT	3
+statement/sp/set	ifac	STATEMENT	3
+statement/sp/jump	ifac	STATEMENT	3
+statement/sp/jump_if_not	ifac	STATEMENT	3
+statement/sp/stmt	trg	STATEMENT	2
+statement/sp/stmt	iotest	STATEMENT	1
+statement/sql/call_procedure	NULL	NULL	0
+statement/sql/select	NULL	NULL	0
+statement/sql/delete	NULL	NULL	0
+statement/sp/freturn	inc	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	2
+statement/sp/jump	fac	STATEMENT	2
+statement/sp/jump_if_not	fac	STATEMENT	2
+statement/sp/freturn	fac	STATEMENT	2
+statement/sp/freturn	mul	STATEMENT	2
+statement/sp/freturn	fun	STATEMENT	1
+statement/sql/select	NULL	NULL	0
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/freturn	fac	STATEMENT	3
+statement/sp/stmt	ifac	STATEMENT	2
+statement/sp/set	ifac	STATEMENT	2
+statement/sp/jump	ifac	STATEMENT	2
+statement/sp/jump_if_not	ifac	STATEMENT	2
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/jump	fac	STATEMENT	3
+statement/sp/jump_if_not	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+statement/sp/set	fac	STATEMENT	3
+TRUNCATE TABLE performance_schema.events_statements_history;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+TRUNCATE TABLE performance_schema.events_statements_current;
+DROP PROCEDURE c4;
+DROP PROCEDURE c3;
+DROP PROCEDURE c2;
+DROP PROCEDURE c1;
+DROP PROCEDURE inc;
+DROP PROCEDURE inc2;
+DROP PROCEDURE iotest;
+DROP FUNCTION mul;
+DROP FUNCTION inc;
+DROP FUNCTION fac;
+DROP FUNCTION fun;
+DROP PROCEDURE ifac;
+DROP TRIGGER trg;
+DROP TABLE t1,t2;
+DROP DATABASE nested_sp;

=== added file 'mysql-test/suite/perfschema/r/statement_program_non_nested.result'
--- a/mysql-test/suite/perfschema/r/statement_program_non_nested.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/statement_program_non_nested.result	2013-07-10 08:28:38 +0000
@@ -0,0 +1,441 @@
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+###########################################
+# Quering PS statement summary and history #
+########################################### 
+# SET-UP 
+CREATE DATABASE stored_programs;
+USE stored_programs;
+CREATE TABLE t1(
+i INT NOT NULL,
+j INT
+);
+CREATE TABLE t2(
+name   CHAR(16) NOT NULL DEFAULT '',
+id INT NOT NULL
+);
+CREATE TABLE t3(
+d DATE,
+n INT,
+f DOUBLE,
+s VARCHAR(32)
+);
+CREATE TABLE t4(
+`k` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`word` varchar(100) NOT NULL,
+`mean` varchar(300) NOT NULL,
+PRIMARY KEY (`k`)
+);
+############################
+# Creating Stored Programs #
+############################
+# Stored Routine ( Procedure & Function )
+CREATE PROCEDURE SampleProc1(x1 INT, x2 INT, y INT)
+BEGIN
+INSERT INTO t1 VALUES (x1, y);
+INSERT INTO t1 VALUES (x2, y);
+END|
+CREATE PROCEDURE SampleProc2(x CHAR(16), y INT)
+BEGIN
+DECLARE z1, z2 INT;
+SET z1 = y;
+SET z2 = z1+2;
+INSERT INTO t2 VALUES (x, z2);
+END|
+CREATE PROCEDURE SampleProc3()
+BEGIN
+DECLARE ld DATE;
+DECLARE li INT;
+DECLARE lf DOUBLE;
+DECLARE ls VARCHAR(32);
+SET ld = NULL, li = NULL, lf = NULL, ls = NULL;
+INSERT INTO t3 VALUES (ld, li, lf, ls);
+INSERT INTO t3 (n, f, s) VALUES ((ld IS NULL), 1,    "ld is null"),
+((li IS NULL), 1,    "li is null"),
+((li = 0),     NULL, "li = 0"),
+((lf IS NULL), 1,    "lf is null"),
+((lf = 0),     NULL, "lf = 0"),
+((ls IS NULL), 1,    "ls is null");
+END|
+CREATE PROCEDURE SampleProc4()
+BEGIN
+DECLARE x  INT;
+SET x = 1;
+WHILE x  <= 2 DO
+INSERT INTO t4(word, mean) VALUES('a','a mean');
+SET  x = x + 1;
+END WHILE;
+END|
+CREATE FUNCTION append(s1 CHAR(8), s2 CHAR(8)) RETURNS CHAR(16)
+RETURN concat(s1, s2)|
+CREATE FUNCTION wt_avg(n1 INT, n2 INT, n3 INT, n4 INT)
+RETURNS INT
+DETERMINISTIC
+BEGIN
+DECLARE avg INT;
+SET avg = (n1+n2+n3*2+n4*4)/8;
+RETURN avg;
+END|
+CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
+BEGIN
+DECLARE f BIGINT UNSIGNED DEFAULT 1;
+WHILE n > 1 DO
+SET f = f * n;
+SET n = n - 1;
+END WHILE;
+RETURN f;
+END|
+# Triggers
+CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+if isnull(new.j) then
+SET new.j:= new.i * 10;
+END if;
+END|
+CREATE TRIGGER trg2 AFTER INSERT ON t2 FOR EACH ROW
+BEGIN
+UPDATE t1 SET i=new.id+i ;
+END|
+CREATE TRIGGER trg3 AFTER UPDATE ON t2 FOR EACH ROW
+SET @change:= @change + new.id - old.id|
+CREATE TRIGGER trg4 BEFORE DELETE ON t1 FOR EACH ROW
+SET @del:= @del + old.j|
+CREATE TRIGGER trg5 AFTER DELETE ON t1 FOR EACH ROW 
+SET @del:= 1|
+# Events 
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='stored_programs';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+PROCEDURE	stored_programs	SampleProc1	0	0
+PROCEDURE	stored_programs	SampleProc2	0	0
+PROCEDURE	stored_programs	SampleProc3	0	0
+PROCEDURE	stored_programs	SampleProc4	0	0
+FUNCTION	stored_programs	append	0	0
+FUNCTION	stored_programs	wt_avg	0	0
+FUNCTION	stored_programs	fac	0	0
+TRIGGER	stored_programs	trg2	0	0
+TRIGGER	stored_programs	trg1	0	0
+TRIGGER	stored_programs	trg4	0	0
+#####################
+# Executing queries #
+#####################
+INSERT INTO t1 VALUES (10,20);
+CALL SampleProc1(30,40,50);
+SET @a=1;
+SELECT @a;
+@a
+1
+CALL SampleProc2("Jwalamukhi",34);
+SELECT @a;
+@a
+1
+CALL SampleProc3();
+CALL SampleProc4();
+SET @change=1;
+SELECT @change;
+@change
+1
+UPDATE t2 SET id=22 WHERE name="Jwalamukhi";
+SELECT @change;
+@change
+-13
+SET @del=1;
+SELECT @del;
+@del
+1
+DELETE FROM t1 WHERE i=40;
+SELECT @del;
+@del
+1
+SELECT wt_avg(1, 12, 1990, 1121990);
+wt_avg(1, 12, 1990, 1121990)
+561494
+SELECT fac(5);
+fac(5)
+120
+SELECT append("Bolly", "wood");
+append("Bolly", "wood")
+Bollywood
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='stored_programs';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+PROCEDURE	stored_programs	SampleProc1	1	2
+PROCEDURE	stored_programs	SampleProc2	1	5
+PROCEDURE	stored_programs	SampleProc3	1	10
+PROCEDURE	stored_programs	SampleProc4	1	11
+FUNCTION	stored_programs	append	1	1
+FUNCTION	stored_programs	wt_avg	1	3
+FUNCTION	stored_programs	fac	1	19
+TRIGGER	stored_programs	trg2	1	1
+TRIGGER	stored_programs	trg1	3	3
+TRIGGER	stored_programs	trg4	0	0
+TRIGGER	stored_programs	trg5	0	0
+TRIGGER	stored_programs	trg3	1	1
+SELECT EVENT_NAME, SQL_TEXT, CURRENT_SCHEMA, OBJECT_TYPE, OBJECT_SCHEMA,
+OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL FROM
+performance_schema.events_statements_history_long WHERE
+CURRENT_SCHEMA='stored_programs';
+EVENT_NAME	SQL_TEXT	CURRENT_SCHEMA	OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
+statement/sql/create_table	CREATE TABLE t1(
+i INT NOT NULL,
+j INT
+)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_table	CREATE TABLE t2(
+name   CHAR(16) NOT NULL DEFAULT '',
+id INT NOT NULL
+)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_table	CREATE TABLE t3(
+d DATE,
+n INT,
+f DOUBLE,
+s VARCHAR(32)
+)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_table	CREATE TABLE t4(
+`k` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`word` varchar(100) NOT NULL,
+`mean` varchar(300) NOT NULL,
+PRIMARY KEY (`k`)
+)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_procedure	CREATE PROCEDURE SampleProc1(x1 INT, x2 INT, y INT)
+BEGIN
+INSERT INTO t1 VALUES (x1, y);
+INSERT INTO t1 VALUES (x2, y);
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_procedure	CREATE PROCEDURE SampleProc2(x CHAR(16), y INT)
+BEGIN
+DECLARE z1, z2 INT;
+SET z1 = y;
+SET z2 = z1+2;
+INSERT INTO t2 VALUES (x, z2);
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_procedure	CREATE PROCEDURE SampleProc3()
+BEGIN
+DECLARE ld DATE;
+DECLARE li INT;
+DECLARE lf DOUBLE;
+DECLARE ls VARCHAR(32);
+SET ld = NULL, li = NULL, lf = NULL, ls = NULL;
+INSERT INTO t3 VALUES (ld, li, lf, ls);
+INSERT INTO t3 (n, f, s) VALUES ((ld IS NULL), 1,    "ld is null"),
+((li IS NULL), 1,    "li is null"),
+((li = 0),     NULL, "li = 0"),
+((lf IS NULL), 1,    "lf is null"),
+((lf = 0),     NULL, "lf = 0"),
+((ls IS NULL), 1,    "ls is null");
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_procedure	CREATE PROCEDURE SampleProc4()
+BEGIN
+DECLARE x  INT;
+SET x = 1;
+WHILE x  <= 2 DO
+INSERT INTO t4(word, mean) VALUES('a','a mean');
+SET  x = x + 1;
+END WHILE;
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_function	CREATE FUNCTION append(s1 CHAR(8), s2 CHAR(8)) RETURNS CHAR(16)
+RETURN concat(s1, s2)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_function	CREATE FUNCTION wt_avg(n1 INT, n2 INT, n3 INT, n4 INT)
+RETURNS INT
+DETERMINISTIC
+BEGIN
+DECLARE avg INT;
+SET avg = (n1+n2+n3*2+n4*4)/8;
+RETURN avg;
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_function	CREATE FUNCTION fac(n INT UNSIGNED) RETURNS BIGINT UNSIGNED
+BEGIN
+DECLARE f BIGINT UNSIGNED DEFAULT 1;
+WHILE n > 1 DO
+SET f = f * n;
+SET n = n - 1;
+END WHILE;
+RETURN f;
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_trigger	CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+if isnull(new.j) then
+SET new.j:= new.i * 10;
+END if;
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_trigger	CREATE TRIGGER trg2 AFTER INSERT ON t2 FOR EACH ROW
+BEGIN
+UPDATE t1 SET i=new.id+i ;
+END	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_trigger	CREATE TRIGGER trg3 AFTER UPDATE ON t2 FOR EACH ROW
+SET @change:= @change + new.id - old.id	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_trigger	CREATE TRIGGER trg4 BEFORE DELETE ON t1 FOR EACH ROW
+SET @del:= @del + old.j	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/create_trigger	CREATE TRIGGER trg5 AFTER DELETE ON t1 FOR EACH ROW 
+SET @del:= 1	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='stored_programs'	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/jump_if_not	NULL	stored_programs	TRIGGER	stored_programs	trg1	STATEMENT	1
+statement/sql/insert	INSERT INTO t1 VALUES (10,20)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/jump_if_not	NULL	stored_programs	TRIGGER	stored_programs	trg1	STATEMENT	2
+statement/sp/stmt	INSERT INTO t1 VALUES (x1, y)	stored_programs	PROCEDURE	stored_programs	SampleProc1	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	TRIGGER	stored_programs	trg1	STATEMENT	2
+statement/sp/stmt	INSERT INTO t1 VALUES (x2, y)	stored_programs	PROCEDURE	stored_programs	SampleProc1	STATEMENT	1
+statement/sql/call_procedure	CALL SampleProc1(30,40,50)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/set_option	SET @a=1	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT @a	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc2	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc2	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc2	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc2	STATEMENT	1
+statement/sp/stmt	UPDATE t1 SET i=new.id+i	stored_programs	TRIGGER	stored_programs	trg2	STATEMENT	2
+statement/sp/stmt	INSERT INTO t2 VALUES (x, z2)	stored_programs	PROCEDURE	stored_programs	SampleProc2	STATEMENT	1
+statement/sql/call_procedure	CALL SampleProc2("Jwalamukhi",34)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT @a	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/stmt	INSERT INTO t3 VALUES (ld, li, lf, ls)	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sp/stmt	INSERT INTO t3 (n, f, s) VALUES ((ld IS NULL), 1,    "ld is null"),
+((li IS NULL), 1,    "li is null"),
+((li = 0),     NULL, "li = 0"),
+((lf IS NULL), 1,    "lf is null"),
+((lf = 0),     NULL, "lf = 0"),
+((ls IS NULL), 1,    "ls is null")	stored_programs	PROCEDURE	stored_programs	SampleProc3	STATEMENT	1
+statement/sql/call_procedure	CALL SampleProc3()	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/stmt	INSERT INTO t4(word, mean) VALUES('a','a mean')	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/jump	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/stmt	INSERT INTO t4(word, mean) VALUES('a','a mean')	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/set	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/jump	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	PROCEDURE	stored_programs	SampleProc4	STATEMENT	1
+statement/sql/call_procedure	CALL SampleProc4()	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/set_option	SET @change=1	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT @change	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/stmt	SET @change:= @change + new.id - old.id	stored_programs	TRIGGER	stored_programs	trg3	STATEMENT	1
+statement/sql/update	UPDATE t2 SET id=22 WHERE name="Jwalamukhi"	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT @change	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/set_option	SET @del=1	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT @del	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/delete	DELETE FROM t1 WHERE i=40	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT @del	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	wt_avg	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	wt_avg	STATEMENT	1
+statement/sp/freturn	NULL	stored_programs	FUNCTION	stored_programs	wt_avg	STATEMENT	1
+statement/sql/select	SELECT wt_avg(1, 12, 1990, 1121990)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/set	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/jump_if_not	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sp/freturn	NULL	stored_programs	FUNCTION	stored_programs	fac	STATEMENT	1
+statement/sql/select	SELECT fac(5)	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sp/freturn	NULL	stored_programs	FUNCTION	stored_programs	append	STATEMENT	1
+statement/sql/select	SELECT append("Bolly", "wood")	stored_programs	NULL	NULL	NULL	NULL	0
+statement/sql/select	SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='stored_programs'	stored_programs	NULL	NULL	NULL	NULL	0
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, SUM_NO_GOOD_INDEX_USED
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='stored_programs';
+OBJECT_TYPE	OBJECT_SCHEMA	SUM_NO_GOOD_INDEX_USED
+PROCEDURE	stored_programs	0
+PROCEDURE	stored_programs	0
+PROCEDURE	stored_programs	0
+PROCEDURE	stored_programs	0
+FUNCTION	stored_programs	0
+FUNCTION	stored_programs	0
+FUNCTION	stored_programs	0
+TRIGGER	stored_programs	0
+TRIGGER	stored_programs	0
+TRIGGER	stored_programs	0
+TRIGGER	stored_programs	0
+TRIGGER	stored_programs	0
+# clean -up
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='stored_programs';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+PROCEDURE	stored_programs	SampleProc1	0	0
+PROCEDURE	stored_programs	SampleProc2	0	0
+PROCEDURE	stored_programs	SampleProc3	0	0
+PROCEDURE	stored_programs	SampleProc4	0	0
+FUNCTION	stored_programs	append	0	0
+FUNCTION	stored_programs	wt_avg	0	0
+FUNCTION	stored_programs	fac	0	0
+TRIGGER	stored_programs	trg2	0	0
+TRIGGER	stored_programs	trg1	0	0
+TRIGGER	stored_programs	trg4	0	0
+TRIGGER	stored_programs	trg5	0	0
+TRIGGER	stored_programs	trg3	0	0
+DROP PROCEDURE SampleProc1;
+DROP PROCEDURE SampleProc2;
+DROP PROCEDURE SampleProc3;
+DROP PROCEDURE SampleProc4;
+DROP FUNCTION wt_avg;
+DROP FUNCTION fac;
+DROP FUNCTION append;
+DROP TRIGGER trg1;
+DROP TRIGGER trg2;
+DROP TRIGGER trg3;
+DROP TRIGGER trg4;
+DROP TRIGGER trg5;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
+DROP DATABASE stored_programs;
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='stored_programs';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+CREATE TABLE test.t1(
+a INT,
+b INT
+);
+CREATE PROCEDURE test.p(x1 INT, x2 INT)
+BEGIN
+INSERT INTO t1 VALUES (x1, x2);
+END|
+CREATE FUNCTION test.f(y1 INT, y2 INT) RETURNS INT
+RETURN y1+y2;
+CREATE TRIGGER test.trg AFTER INSERT ON test.t1 FOR EACH ROW
+SET @neg=-1;
+CALL test.p(7);
+ERROR 42000: Incorrect number of arguments for PROCEDURE test.p; expected 2, got 1
+SELECT test.f("add",1,3);
+ERROR 42000: Incorrect number of arguments for FUNCTION test.f; expected 2, got 3
+INSERT INTO test.t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS
+FROM performance_schema.events_statements_summary_by_program
+WHERE OBJECT_SCHEMA='test';
+OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	COUNT_STAR	COUNT_STATEMENTS
+PROCEDURE	test	p	0	0
+FUNCTION	test	f	0	0
+DROP PROCEDURE test.p;
+DROP FUNCTION test.f;
+DROP TRIGGER test.trg;
+DROP TABLE test.t1;

=== removed file 'mysql-test/suite/perfschema/r/sub_statement.result'
--- a/mysql-test/suite/perfschema/r/sub_statement.result	2013-05-24 09:27:08 +0000
+++ b/mysql-test/suite/perfschema/r/sub_statement.result	1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-####################################
-# SETUP
-####################################
-CREATE DATABASE sub_statements;
-USE sub_statements;
-CREATE TABLE t1(c1 INT);
-CREATE TABLE t2(c1 INT);
-CREATE TRIGGER simple_trigger BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO
-t2 VALUES('12');
-CREATE PROCEDURE simple_procedure (OUT param1 INT) 
-BEGIN 
-SELECT COUNT(*) INTO PARAM1 FROM t1; 
-INSERT INTO t1 values('2');
-END //
-CREATE FUNCTION simple_function (s CHAR(20)) RETURNS CHAR(50)
-BEGIN 
-INSERT INTO t1 values('3');
-RETURN s;
-END //
-TRUNCATE TABLE performance_schema.events_statements_history;
-####################################
-# EXECUTING QUERIES
-####################################
-INSERT INTO t1 VALUES('1');
-CALL simple_procedure(@a);
-SELECT simple_function('Hello');
-simple_function('Hello')
-Hello
-####################################
-# QUERYING PS STATEMENT HISTORY
-####################################
-SELECT EVENT_NAME, SQL_TEXT, CURRENT_SCHEMA, OBJECT_TYPE, OBJECT_SCHEMA,
-OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL from
-performance_schema.events_statements_history WHERE
-CURRENT_SCHEMA='sub_statements';
-EVENT_NAME	SQL_TEXT	CURRENT_SCHEMA	OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	NESTING_EVENT_TYPE	NESTING_EVENT_LEVEL
-statement/sql/select	SELECT simple_function('Hello')	sub_statements	NULL	NULL	NULL	NULL	0
-statement/sp/stmt	INSERT INTO
-t2 VALUES('12')	sub_statements	TRIGGER	sub_statements	simple_trigger	STATEMENT	1
-statement/sql/insert	INSERT INTO t1 VALUES('1')	sub_statements	NULL	NULL	NULL	NULL	0
-statement/sp/stmt	SELECT COUNT(*) INTO PARAM1 FROM t1	sub_statements	PROCEDURE	sub_statements	simple_procedure	STATEMENT	1
-statement/sp/stmt	INSERT INTO
-t2 VALUES('12')	sub_statements	TRIGGER	sub_statements	simple_trigger	STATEMENT	2
-statement/sp/stmt	INSERT INTO t1 values('2')	sub_statements	PROCEDURE	sub_statements	simple_procedure	STATEMENT	1
-statement/sql/call_procedure	CALL simple_procedure(@a)	sub_statements	NULL	NULL	NULL	NULL	0
-statement/sp/stmt	INSERT INTO
-t2 VALUES('12')	sub_statements	TRIGGER	sub_statements	simple_trigger	STATEMENT	2
-statement/sp/stmt	INSERT INTO t1 values('3')	sub_statements	FUNCTION	sub_statements	simple_function	STATEMENT	1
-statement/sp/freturn	NULL	sub_statements	FUNCTION	sub_statements	simple_function	STATEMENT	1
-####################################
-# CLEANUP
-####################################
-DROP TABLE t1;
-DROP TABLE t2;
-DROP DATABASE IF EXISTS sub_statements;

=== added file 'mysql-test/suite/perfschema/t/statement_program_nested.test'
--- a/mysql-test/suite/perfschema/t/statement_program_nested.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/statement_program_nested.test	2013-07-10 08:28:38 +0000
@@ -0,0 +1,47 @@
+# -----------------------------------------------------------------------
+# Tests for the performance schema nested stored program instrumentation.
+# -----------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+
+--echo ###########################################
+--echo # Quering PS statement summary and history #
+--echo ###########################################
+
+--source suite/perfschema/include/program_nested_setup.inc
+# Stored programs donot get into PS tables just after creation. 
+# They do only after successful execution.  
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='nested_sp';
+
+--source suite/perfschema/include/program_nested_execution.inc
+
+SELECT EVENT_NAME, SQL_TEXT, CURRENT_SCHEMA, OBJECT_TYPE, OBJECT_SCHEMA,
+       OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL 
+       FROM performance_schema.events_statements_history_long WHERE
+       CURRENT_SCHEMA='nested_sp';
+
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='nested_sp';
+
+--echo # clean-up
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+
+# After truncate the statictics collected will are reset
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='nested_sp';
+
+--source suite/perfschema/include/program_nested_cleanup.inc
+
+# After clean-up the stored programs are removed from PS tables 
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='nested_sp';

=== added file 'mysql-test/suite/perfschema/t/statement_program_nesting_event_check.test'
--- a/mysql-test/suite/perfschema/t/statement_program_nesting_event_check.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/statement_program_nesting_event_check.test	2013-07-10 08:28:38 +0000
@@ -0,0 +1,61 @@
+#--------------------------------------------------------------------
+# Test to check the values populated in NESTING_EVENT_TYPE 
+# columns of events_statements_current/history/history_long PS tables. 
+#--------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+TRUNCATE TABLE performance_schema.events_statements_history;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+TRUNCATE TABLE performance_schema.events_statements_current;
+
+--echo #----------------------------
+--echo # Non-nested Stored programs.
+--echo #----------------------------
+--source suite/perfschema/include/program_setup.inc
+--source suite/perfschema/include/program_execution.inc
+
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+       FROM performance_schema.events_statements_current WHERE
+       CURRENT_SCHEMA='stored_programs';
+
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+       FROM performance_schema.events_statements_history WHERE
+       CURRENT_SCHEMA='stored_programs';
+
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+       FROM performance_schema.events_statements_history_long WHERE
+       CURRENT_SCHEMA='stored_programs';
+
+TRUNCATE TABLE performance_schema.events_statements_history;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+TRUNCATE TABLE performance_schema.events_statements_current;
+
+# Clean-up
+--source suite/perfschema/include/program_cleanup.inc
+
+--echo #------------------------
+--echo # Nested stored programs.
+--echo #------------------------
+--source suite/perfschema/include/program_nested_setup.inc
+--source suite/perfschema/include/program_nested_execution.inc
+
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+       FROM performance_schema.events_statements_current WHERE
+       CURRENT_SCHEMA='nested_sp';
+
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+       FROM performance_schema.events_statements_history WHERE
+       CURRENT_SCHEMA='nested_sp';
+
+SELECT EVENT_NAME, OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL
+       FROM performance_schema.events_statements_history_long WHERE
+       CURRENT_SCHEMA='nested_sp';
+
+TRUNCATE TABLE performance_schema.events_statements_history;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+TRUNCATE TABLE performance_schema.events_statements_current;
+
+# Clean-up
+--source suite/perfschema/include/program_nested_cleanup.inc

=== added file 'mysql-test/suite/perfschema/t/statement_program_non_nested.test'
--- a/mysql-test/suite/perfschema/t/statement_program_non_nested.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/statement_program_non_nested.test	2013-07-10 08:28:38 +0000
@@ -0,0 +1,105 @@
+# -----------------------------------------------------------------------
+# Tests for the performance schema stored program instrumentation.
+# -----------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+
+--echo ###########################################
+--echo # Quering PS statement summary and history #
+--echo ########################################### 
+
+--source suite/perfschema/include/program_setup.inc
+# Stored programs donot get into PS tables just after creation. 
+# They do only after successful execution.  
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='stored_programs';
+
+--source suite/perfschema/include/program_execution.inc
+
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='stored_programs';
+
+SELECT EVENT_NAME, SQL_TEXT, CURRENT_SCHEMA, OBJECT_TYPE, OBJECT_SCHEMA,
+       OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL FROM
+       performance_schema.events_statements_history_long WHERE
+       CURRENT_SCHEMA='stored_programs';
+
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, SUM_NO_GOOD_INDEX_USED
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='stored_programs';
+
+--echo # clean -up
+
+TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+TRUNCATE TABLE performance_schema.events_statements_history_long;
+
+# After truncate the statictics collected will are reset
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='stored_programs';
+
+--source suite/perfschema/include/program_cleanup.inc 
+
+# After clean-up the stored programs are removed from PS tables 
+
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS 
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='stored_programs';
+
+# general test
+#TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+#TRUNCATE TABLE performance_schema.events_statements_history_long;
+
+#--source suite/perfschema/include/program_setup.inc
+#--source suite/perfschema/include/program_execution.inc
+#SELECT OBJECT_TYPE, OBJECT_SCHEMA, SUM_NO_GOOD_INDEX_USED 
+#       FROM performance_schema.events_statements_summary_by_program;
+
+#TRUNCATE TABLE performance_schema.events_statements_summary_by_program;
+#--source suite/perfschema/include/program_cleanup.inc
+
+#
+# The statistics of a stored program are not collected 
+# if its execution fails 
+#
+
+CREATE TABLE test.t1(
+  a INT,
+  b INT
+);
+
+DELIMITER |;
+CREATE PROCEDURE test.p(x1 INT, x2 INT)
+BEGIN
+  INSERT INTO t1 VALUES (x1, x2);
+END|
+DELIMITER ;|
+
+CREATE FUNCTION test.f(y1 INT, y2 INT) RETURNS INT
+  RETURN y1+y2;
+
+CREATE TRIGGER test.trg AFTER INSERT ON test.t1 FOR EACH ROW
+  SET @neg=-1;
+
+--error 1318
+CALL test.p(7);
+--error 1318
+SELECT test.f("add",1,3);
+--error 1064
+INSERT INTO test.t1;
+
+SELECT OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME, COUNT_STAR, COUNT_STATEMENTS
+       FROM performance_schema.events_statements_summary_by_program
+       WHERE OBJECT_SCHEMA='test';
+
+DROP PROCEDURE test.p;
+DROP FUNCTION test.f;
+DROP TRIGGER test.trg;
+DROP TABLE test.t1;
+

=== removed file 'mysql-test/suite/perfschema/t/sub_statement.test'
--- a/mysql-test/suite/perfschema/t/sub_statement.test	2013-05-24 09:27:08 +0000
+++ b/mysql-test/suite/perfschema/t/sub_statement.test	1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-# -----------------------------------------------------------------------
-# Tests for the performance schema stored program's sub statements'
-# instrumentation.
-# -----------------------------------------------------------------------
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
-
---echo ####################################
---echo # SETUP
---echo ####################################
---disable_warnings
-CREATE DATABASE sub_statements;
-USE sub_statements;
-CREATE TABLE t1(c1 INT);
-CREATE TABLE t2(c1 INT);
---enable_warnings
-
-# Creating Trigger
-CREATE TRIGGER simple_trigger BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO
- t2 VALUES('12');
-
-# Creaing Stored Procedure
-DELIMITER //;
-CREATE PROCEDURE simple_procedure (OUT param1 INT) 
-BEGIN 
-  SELECT COUNT(*) INTO PARAM1 FROM t1; 
-  INSERT INTO t1 values('2');
-END //
-
-# Creating Function
-CREATE FUNCTION simple_function (s CHAR(20)) RETURNS CHAR(50)
-BEGIN 
-  INSERT INTO t1 values('3');
-  RETURN s;
-END //
-DELIMITER ;//
-
-TRUNCATE TABLE performance_schema.events_statements_history;
-
---echo ####################################
---echo # EXECUTING QUERIES
---echo ####################################
-INSERT INTO t1 VALUES('1');
-CALL simple_procedure(@a);
-SELECT simple_function('Hello');
-
---echo ####################################
---echo # QUERYING PS STATEMENT HISTORY
---echo ####################################
-SELECT EVENT_NAME, SQL_TEXT, CURRENT_SCHEMA, OBJECT_TYPE, OBJECT_SCHEMA,
-       OBJECT_NAME, NESTING_EVENT_TYPE, NESTING_EVENT_LEVEL from
-       performance_schema.events_statements_history WHERE
-       CURRENT_SCHEMA='sub_statements';
-
---echo ####################################
---echo # CLEANUP
---echo ####################################
---disable_warnings
-DROP TABLE t1;
-DROP TABLE t2;
-DROP DATABASE IF EXISTS sub_statements;
---enable_warnings

=== renamed file 'mysql-test/suite/sys_vars/t/pfs_max_routine_instances_basic-master.opt' => 'mysql-test/suite/sys_vars/t/pfs_max_program_instances_basic-master.opt'
=== modified file 'mysql-test/suite/sys_vars/t/pfs_max_program_instances_basic.test'
--- a/mysql-test/suite/sys_vars/t/pfs_max_program_instances_basic.test	2013-05-08 11:06:26 +0000
+++ b/mysql-test/suite/sys_vars/t/pfs_max_program_instances_basic.test	2013-07-10 08:28:38 +0000
@@ -2,6 +2,13 @@
 --source include/have_perfschema.inc
 
 #
+# Display default value
+#
+
+select @@global.performance_schema_max_program_instances;
+
+
+#
 # Only global
 #
 
@@ -30,3 +37,23 @@ set global performance_schema_max_progra
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 set session performance_schema_max_program_instances=1;
 
+#
+# Check if the value in GLOBAL Table matches value in variable
+#
+
+SELECT @@GLOBAL.performance_schema_max_program_instances = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='performance_schema_max_program_instances';
+
+select @@global.performance_schema_max_program_instances;
+
+select * from information_schema.global_variables
+  where variable_name='performance_schema_max_program_instances';
+
+#
+# Check if accessing variable with and without GLOBAL point to same variable
+#
+
+SELECT @@performance_schema_max_program_instances = @@GLOBAL.performance_schema_max_program_instances;
+
+

=== renamed file 'mysql-test/suite/sys_vars/t/pfs_statement_stack_size_basic-master.opt' => 'mysql-test/suite/sys_vars/t/pfs_max_statement_stack_basic-master.opt'
=== modified file 'mysql-test/suite/sys_vars/t/pfs_max_statement_stack_basic.test'
--- a/mysql-test/suite/sys_vars/t/pfs_max_statement_stack_basic.test	2013-05-08 11:06:26 +0000
+++ b/mysql-test/suite/sys_vars/t/pfs_max_statement_stack_basic.test	2013-07-10 08:28:38 +0000
@@ -17,6 +17,11 @@
 --source include/have_perfschema.inc
 
 #
+# Display default value
+#
+select @@global.performance_schema_max_statement_stack;
+
+#
 # Only global
 #
 
@@ -45,3 +50,22 @@ set global performance_schema_max_statem
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 set session performance_schema_max_statement_stack=1;
 
+#
+# Check if the value in GLOBAL Table matches value in variable
+#
+
+SELECT @@GLOBAL.performance_schema_max_statement = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='performance_schema_max_statement_stack';
+
+select @@global.performance_schema_max_statement_stack;
+
+select * from information_schema.global_variables
+  where variable_name='performance_schema_max_statement_stack';
+
+#
+# Check if accessing variable with and without GLOBAL point to same variable
+#
+
+SELECT @@performance_schema_max_statement_stack = @@GLOBAL.performance_schema_max_statement_stack; 
+

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (akhila.x.maddukuri:5721 to 5722) WL#5766Akhila Maddukuri20 Aug