Bug #70358 | GET DIAGNOSTICS produces a warning with level 'error', suppressed in procedure | ||
---|---|---|---|
Submitted: | 16 Sep 2013 18:50 | Modified: | 17 Sep 2013 17:34 |
Reporter: | Elena Stepanova | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Errors | Severity: | S3 (Non-critical) |
Version: | 5.6.13 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[16 Sep 2013 18:50]
Elena Stepanova
[17 Sep 2013 17:34]
MySQL Verification Team
Hello Elena, Thank you for the report and test case. Verified as reported. Imho the warning seems to be documented behavior "A warning occurs if the condition number is not in the range from 1 to the number of condition areas that have information" - http://dev.mysql.com/doc/refman/5.6/en/get-diagnostics.html But again the warning of Level "Error" seems to be bit unusual here, this should be fixed or at least documented. // mysql> GET DIAGNOSTICS CONDITION 0 @a = MYSQL_ERRNO; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> show warnings; +-------+------+--------------------------+ | Level | Code | Message | +-------+------+--------------------------+ | Error | 1758 | Invalid condition number | +-------+------+--------------------------+ 1 row in set (0.00 sec) mysql> show errors; +-------+------+--------------------------+ | Level | Code | Message | +-------+------+--------------------------+ | Error | 1758 | Invalid condition number | +-------+------+--------------------------+ 1 row in set (0.00 sec) // Without SHOW statements, warning was supressed.. mysql> drop procedure if exists p; Query OK, 0 rows affected (0.00 sec) mysql> mysql> mysql> delimiter || mysql> create procedure p() -> begin -> GET DIAGNOSTICS CONDITION 0 @a = MYSQL_ERRNO ; -> show warnings; -> show errors; -> -> end || Query OK, 0 rows affected (0.00 sec) mysql> delimiter ; mysql> call p(); +-------+------+--------------------------+ | Level | Code | Message | +-------+------+--------------------------+ | Error | 1758 | Invalid condition number | +-------+------+--------------------------+ 1 row in set (0.00 sec) +-------+------+--------------------------+ | Level | Code | Message | +-------+------+--------------------------+ | Error | 1758 | Invalid condition number | +-------+------+--------------------------+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Thanks, Umesh
[18 Sep 2013 9:51]
Jon Olav Hauglid
Hi Elena! The problem with the condition being suppressed inside a stored procedure has been fixed in 5.7. I have not checked, but I would guess it was fixed as a consequence of the implementation of GET STACKED DIAGNOSTICS. So now you get: CALL p1(); Warnings: Error 1758 Invalid condition number That the level is 'error' seems a bit strange, but as far as I can see it was part of the GET DIAGNOSTICS design. We could downgrade it to 'Warning' as this would be more consistent with GET DIAGNOSTICS not failing.
[18 Sep 2013 21:11]
Davi Arnaut
IIRC, the standard says an exception condition should be raised without disturbing the contents of the DA. It is an error, it just doesn't affect the DA.