Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3.1-1
Description
PR:396 implements stored routine error stack trace.
Example
This script creates two procedures. p2 calls p1, and p1 opens a cursor using a non-existing table:
DELIMITER $$
|
CREATE OR REPLACE PROCEDURE p1() |
BEGIN
|
DECLARE c CURSOR FOR SELECT * FROM not_existing; |
OPEN c; |
CLOSE c; |
END; |
$$
|
CREATE OR REPLACE PROCEDURE p2() |
BEGIN
|
CALL p1;
|
END; |
$$
|
DELIMITER ;
|
CALL p2;
|
ERROR 1146 (42S02): Table 'test.not_existing' doesn't exist
|
The script returns an error, as expected.
Now it's possible to get additional diagnostics:
SHOW WARNINGS;
|
+-------+------+-----------------------------------------+
|
| Level | Code | Message |
|
+-------+------+-----------------------------------------+
|
| Error | 1146 | Table 'test.not_existing' doesn't exist |
|
| Note | 4070 | At line 4 in test.p1 |
|
| Note | 4070 | At line 3 in test.p2 |
|
+-------+------+-----------------------------------------+
|
It displays stack trace, showing where the error actually happened:
- Line 4 in test.p1 is the OPEN command which actually raised the error
- Line 3 in test.p2 is the CALL statement, calling p1 from p2.
Attachments
Issue Links
- links to