Bug #53719 log_warnings is not respected unless global
Submitted: 17 May 2010 20:25 Modified: 15 Oct 2012 14:20
Reporter: Ed Dawley Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.1.45, 5.1.48-bzr, 5.6.99 OS:Any
Assigned to: CPU Architecture:Any
Tags: log_warnings unsafe replication

[17 May 2010 20:25] Ed Dawley
Description:
Issuing a a statement that mysql determines to be unsafe for statement-based replication will cause a warning to be written to the error log.  According to the documentation, log_warnings = 0 should prevent the warning message from being written but this only occurs if set globally.

How to repeat:
CREATE TABLE `one` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `a` varchar(2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `two` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `a` varchar(2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

set global log_warnings=1;
set log_warnings=0;
insert into one select * from two order by id asc limit 1;

Log Output:
100517 14:50:09 [Warning] Statement may not be safe to log in statement format. Statement: insert into one select * from two order by id asc limit 1

set global log_warnings=0;
insert into one select * from two order by id asc limit 1;

Log Output:
N/A

Suggested fix:
Identify log_warnings as not having session scope or modify logging to check the session value.
[26 May 2010 5:44] Sveta Smirnova
Thank you for the report.

Verified as described.
[15 Oct 2012 14:20] Erlend Dahl
log_warnings system variable has been modified to have only Global scope in
latest mysql-5.6 trunk. See the manual. So this bug is not valid in latest
trunk. Marking it as "won't fix"