Bug #84557 Hide specific warnings from SHOW WARNINGS.
Submitted: 18 Jan 2017 16:50 Modified: 19 Jan 2017 7:08
Reporter: Jean-François Gagné Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:5.6 and 5.7 OS:Any
Assigned to: CPU Architecture:Any

[18 Jan 2017 16:50] Jean-François Gagné

in [1], I presented a use-case where one could want to "ignore" specific SQL warnings.  The use-case is as follow: doing an "INSERT IGNORE" which could result in "Duplicate entries" that are not important.

[1]: http://jfg-mysql.blogspot.com/2017/01/do-not-ignore-warnings-in-mysql-mariadb.html

In this use-case, not looking at warnings is bad as another warning could be produced.  Filtering the output of SHOW WARNINGS is not satisfactory as it needs a round-trip to the server and extra work in the application.  The best way to achieve this would be to not report (hide) warnings for code 1062.  Having a generic way to do this is the object of this feature request.

The specific way this is implemented does not matter to me.  I would be ok with an optimizer hint and/or with a session variable (and probably a corresponding global variable).  In both cases, the hint and variable could specify a comma separated list of warnings numbers that should be hidden.  I have a preference for the optimizer hint as this does not need a round-trip to the server but I will leave the details to the implementer.

Hidden warnings should not be reported by "SHOW WARNINGS", by the “warning_count” system variable, and by "SHOW COUNT(*) WARNINGS".  Moreover, after executing a statement, the number of warnings reported should be zero is all warnings produced are hidden.

If we hide warnings, we might also want a way to show them.  Maybe a "SHOW ALL WARNINGS", a “all_warning_count” system variable, and a "SHOW COUNT(*) ALL WARNINGS" could also be implemented.  For "SHOW ALL WARNINGS", if the number of warnings produced is higher than max_error_count, we probably want to drop the warnings that are hidden.

Many thanks,


How to repeat:
See description.

Suggested fix:
See description.
[19 Jan 2017 7:08] MySQL Verification Team
Hello Jean-François,

Thank you for the feature request!