Bug #36106 Stored Procedure call stack in INFORMATION_SCHEMA
Submitted: 16 Apr 2008 0:33 Modified: 18 Apr 2008 8:34
Reporter: Ondra Zizka Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Information schema Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: call stack, I_S, information_schema, SP, stored procedure

[16 Apr 2008 0:33] Ondra Zizka
Description:
Having a call stack available in stored procedures would make debugging much much easier. It could be a table like this:

----------------------------------------------
depth INT  routine_name VARCHAR   routine_type ENUM  started TIMESTAMP ...
1          nn_TeachXOR            PROCEDURE          128458937
2          nn_ComputeNet          PROCEDURE          128458938
3          nn_ComputeLevel        PROCEDURE          128458938
...

How to repeat:
With such table, one could do profiling,

SELECT UNIX_TIMESTAMP() - started AS duration
  FROM INFORMATION_SCHEMA.CALLSTACK
  ORDER BY depth DESC LIMIT 1; 

structured logging, e.g.:

INSERT INTO log
  SELECT CONCAT( REPEAT('  ', ), '+--  ', routine_name) AS str
  ORDER BY depth ASC;

and more...
[18 Apr 2008 8:34] Valeriy Kravchuk
Thank you for a reasonable feature request.