1call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); 2### NOT filtered database => assertion: warnings ARE shown 3DROP TABLE IF EXISTS t1; 4CREATE TABLE t1 (a int, b int, primary key (a)); 5INSERT INTO t1 VALUES (1,2), (2,3); 6UPDATE t1 SET b='4' WHERE a=1 LIMIT 1; 7UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1; 8DROP TABLE t1; 9### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown 10SET SQL_LOG_BIN= 0; 11DROP TABLE IF EXISTS t1; 12CREATE TABLE t1 (a int, b int, primary key (a)); 13INSERT INTO t1 VALUES (1,2), (2,3); 14UPDATE t1 SET b='4' WHERE a=1 LIMIT 1; 15UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1; 16DROP TABLE t1; 17SET SQL_LOG_BIN= 1; 18### FILTERED database => assertion: warnings ARE NOT shown 19CREATE DATABASE b42851; 20USE b42851; 21DROP TABLE IF EXISTS t1; 22CREATE TABLE t1 (a int, b int, primary key (a)); 23INSERT INTO t1 VALUES (1,2), (2,3); 24UPDATE t1 SET b='4' WHERE a=1 LIMIT 1; 25UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1; 26DROP TABLE t1; 27CREATE TABLE t1 (a VARCHAR(1000)); 28INSERT INTO t1 VALUES (CURRENT_USER()); 29INSERT INTO t1 VALUES (FOUND_ROWS()); 30INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); 31INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); 32INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); 33INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); 34INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1)); 35INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); 36INSERT INTO t1 VALUES (ROW_COUNT()); 37INSERT INTO t1 VALUES (SESSION_USER()); 38INSERT INTO t1 VALUES (SLEEP(1)); 39INSERT INTO t1 VALUES (SYSDATE()); 40INSERT INTO t1 VALUES (SYSTEM_USER()); 41INSERT INTO t1 VALUES (USER()); 42INSERT INTO t1 VALUES (UUID()); 43INSERT INTO t1 VALUES (UUID_SHORT()); 44INSERT INTO t1 VALUES (VERSION()); 45INSERT INTO t1 VALUES (RAND()); 46DROP DATABASE b42851; 47USE test; 48# 49# Bug#46265: Can not disable warning about unsafe statements for binary logging 50# 51SET @old_log_warnings = @@log_warnings; 52DROP TABLE IF EXISTS t1; 53CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(15)); 54SET GLOBAL LOG_WARNINGS = 0; 55INSERT INTO t1 VALUES(UUID(), 'timestamp'); 56Warnings: 57Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. 58SET GLOBAL LOG_WARNINGS = 1; 59INSERT INTO t1 VALUES(UUID(), 'timestamp'); 60Warnings: 61Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. 62DROP TABLE t1; 63SET GLOBAL log_warnings = @old_log_warnings; 64# Count the number of times the "Unsafe" message was printed 65# to the error log. 66Occurrences: 1 67DROP TABLE IF EXISTS t1, t2; 68CREATE TABLE t1 (a int); 69CREATE TABLE t2 (a int auto_increment primary key, b int); 70CREATE TRIGGER tr_bug50192 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (b) VALUES (1); 71CREATE FUNCTION sf_bug50192() RETURNS INTEGER 72BEGIN 73INSERT INTO t2(b) VALUES(2); 74RETURN 1; 75END | 76INSERT INTO t1 VALUES (0); 77Warnings: 78Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. 79SHOW WARNINGS; 80Level Code Message 81Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. 82SELECT sf_bug50192(); 83sf_bug50192() 841 85Warnings: 86Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. 87SHOW WARNINGS; 88Level Code Message 89Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly. 90DROP FUNCTION sf_bug50192; 91DROP TRIGGER tr_bug50192; 92DROP TABLE t1, t2; 93