in , 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.
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.