Bug #73147 SQLWARNINGS does not catch all warnings
Submitted: 30 Jun 2014 8:23 Modified: 18 Feb 2016 17:20
Reporter: Federico Razzoli Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[30 Jun 2014 8:23] Federico Razzoli
One could think that the SQLWARNING condition (DECLARE HANDLER) catches all warnings. If nothing else, the name suggests this. However, it is not entirely true. As clearly stated in the documentation, SQLWARNINGS catches conditions whose SQLSTATE starts with '01', which is not the same.

An exception is the note generated with DROP TABLE IF EXISTS. The same should apply at least for all IF [NOT] EXISTS statements. It is an exception (SQLEXCEPTION condition); with IF EXISTS it becomes a note; but the SQLSTATE doesn't change, so it is handled by SQLEXCEPTION, not SQLWARNINGS.

Probably not a bug, as it is consistent. But still, it is a very tricky behavior: SQLWARNINGS is meant to handle non-fatal errors, so one definitely doesn't expect that a note fallse into SQLEXCEPTIONS.

So, if it is not a bug, please consider this bug report as a "documentation request".

How to repeat:
[1 Jul 2014 8:54] MySQL Verification Team
Hello Federico,

Thank you for the report.