diff --git a/mysql-test/extra/rpl_tests/rpl_insert_id.test b/mysql-test/extra/rpl_tests/rpl_insert_id.test index b076e73a2158ed03a9f27311b98dd59da6425364..c8793559b073ee9cdcd989abbe8b34148f960697 100644 --- a/mysql-test/extra/rpl_tests/rpl_insert_id.test +++ b/mysql-test/extra/rpl_tests/rpl_insert_id.test @@ -9,6 +9,8 @@ # column and index but without primary key. ############################################################## +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); + --echo # --echo # Setup --echo # @@ -187,7 +189,9 @@ drop trigger t1_bi; # Check that nested call doesn't affect outer context. select last_insert_id(); +--disable_warnings select bug15728_insert(); +--enable_warnings select last_insert_id(); insert into t1 (last_id) values (bug15728()); # This should be exactly one greater than in the previous call. @@ -440,7 +444,9 @@ delimiter ;| INSERT INTO t1 VALUES (NULL, -1); CALL p1(); +--disable_warnings SELECT f1(); +--enable_warnings INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2()); INSERT INTO t1 VALUES (NULL, f2()); @@ -509,7 +515,9 @@ insert into t2 (id) values(1),(2),(3); delete from t2; set sql_log_bin=1; #inside SELECT, then inside INSERT +--disable_warnings select insid(); +--enable_warnings set sql_log_bin=0; insert into t2 (id) values(5),(6),(7); delete from t2 where id>=5; diff --git a/mysql-test/suite/binlog/r/binlog_stm_do_db.result b/mysql-test/suite/binlog/r/binlog_stm_do_db.result index ab4ba7cdca18c78c106f32aef543ed6f2a1d2a1d..63421a968a433db966a606adbab81740dbea7236 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_do_db.result +++ b/mysql-test/suite/binlog/r/binlog_stm_do_db.result @@ -25,11 +25,11 @@ use b42829; ### binlog-do-db is not filtering used database BEGIN; INSERT INTO t2 VALUES (1,2), (1,3), (1,4); -ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT' +ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2; -ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT' +ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. INSERT INTO t1 SELECT * FROM t2; -ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT' +ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. COMMIT; ### assertion: filtered events did not make into the binlog show binlog events from <binlog_start>; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 854f59c25167251df943eca5c1b2cf763d7f7059..57f34ecb44c0ef0f8da3a74354d0eab9c3942201 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -516,10 +516,10 @@ end| reset master; insert into t2 values (bug27417(1)); Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. insert into t2 select bug27417(2); Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' @@ -539,7 +539,7 @@ count(*) 2 delete from t2 where a=bug27417(3); Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. select count(*) from t2 /* nothing got deleted */; count(*) 2 @@ -555,7 +555,7 @@ count(*) 5 delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. affected rows: 0 select count(*) from t1 /* must be 7 */; count(*) @@ -780,10 +780,10 @@ end| reset master; insert into t2 values (bug27417(1)); Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. insert into t2 select bug27417(2); Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. reset master; insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' @@ -802,7 +802,7 @@ count(*) 2 delete from t2 where a=bug27417(3); Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. select count(*) from t2 /* nothing got deleted */; count(*) 2 @@ -817,7 +817,7 @@ count(*) 5 delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */; Warnings: -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. affected rows: 0 select count(*) from t1 /* must be 7 */; count(*) diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index 18e7f8e9ec67a064d1dd2f24a1c516387b80917a..f6f3b8354e1a865333563e01fff83b4822b73018 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -74,7 +74,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.ta1) @@ -148,7 +150,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -222,7 +226,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.ta1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -284,7 +290,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -350,7 +358,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -458,7 +468,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.ta1) @@ -532,7 +544,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -606,7 +620,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.ta1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -668,7 +684,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -750,7 +768,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -824,7 +844,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.ta1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -886,7 +908,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -952,7 +976,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -1046,7 +1072,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -1120,7 +1148,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.ta1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -1182,7 +1212,9 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S Failure! Event number 3 was a 'Query', not a 'Table_map'. SHOW BINLOG EVENTS FROM <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) master-bin.000001 # Table_map # # table_id: # (test.t0) @@ -1238,1809 +1270,22 @@ Invoking function func_sidef_1 invoking unsafe update of two autoinc columns. CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); RETURN 0; END; * binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t1 SELECT func_sidef_1(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 0 warnings. -CALL proc_2(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO trigger_table_2 VALUES (1); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns. -CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO t2 SELECT * FROM view_sidef_2; -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP VIEW view_sidef_2; - -Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 0 warnings. -EXECUTE prep_2; -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP FUNCTION func_sidef_1; - -Invoking procedure proc_1 invoking unsafe update of two autoinc columns. -CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); END; -* binlog_format = STATEMENT: expect 0 warnings. -CALL proc_1(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT - -Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 0 warnings. -CALL proc_2(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO trigger_table_2 VALUES (1); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns. -PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 0 warnings. -EXECUTE prep_2; -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PREPARE prep_2; -DROP PROCEDURE proc_1; - -Invoking trigger trig_1 invoking unsafe update of two autoinc columns. -CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); END; -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO trigger_table_1 VALUES (1); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 0 warnings. -CALL proc_2(); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO trigger_table_2 VALUES (1); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns. -PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 0 warnings. -EXECUTE prep_2; -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP TRIGGER trig_1; - -Invoking prepared statement prep_1 invoking unsafe update of two autoinc columns. -PREPARE prep_1 FROM "INSERT INTO double_autoinc_table VALUES (NULL)"; -* binlog_format = STATEMENT: expect 0 warnings. -EXECUTE prep_1; -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_1; - -Invoking unsafe update of two autoinc columns. -* binlog_format = STATEMENT: expect 0 warnings. -INSERT INTO double_autoinc_table VALUES (NULL); -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -==== Testing unsafeness of UDF's ==== - -Invoking function func_retval_1 returning value from unsafe UDF. -CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); RETURN myfunc_int(10); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t1 VALUES (func_retval_1()); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -* Invoke statement so that return value is dicarded: expect no warning. -SELECT func_retval_1(); - -Invoking function func_retval_2 returning value from function func_retval_1 returning value from unsafe UDF. -CREATE FUNCTION func_retval_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); RETURN func_retval_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 VALUES (func_retval_2()); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -* Invoke statement so that return value is dicarded: expect no warning. -SELECT func_retval_2(); -DROP FUNCTION func_retval_2; - -Invoking function func_sidef_2 invoking function func_retval_1 returning value from unsafe UDF. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe UDF. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe UDF. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe UDF. -CREATE VIEW view_retval_2 AS SELECT func_retval_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT * FROM view_retval_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -* Invoke statement so that return value is dicarded: expect no warning. -SELECT * FROM view_retval_2; -DROP VIEW view_retval_2; - -Invoking prepared statement prep_2 invoking function func_retval_1 returning value from unsafe UDF. -PREPARE prep_2 FROM "INSERT INTO t1 VALUES (func_retval_1())"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP FUNCTION func_retval_1; - -Invoking function func_sidef_1 invoking unsafe UDF. -CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t1 SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe UDF. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe UDF. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe UDF. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe UDF. -CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP VIEW view_sidef_2; - -Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe UDF. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP FUNCTION func_sidef_1; - -Invoking procedure proc_1 invoking unsafe UDF. -CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe UDF. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe UDF. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe UDF. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe UDF. -PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP PROCEDURE proc_1; - -Invoking trigger trig_1 invoking unsafe UDF. -CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_1 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe UDF. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe UDF. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe UDF. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe UDF. -PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP TRIGGER trig_1; - -Invoking view view_sidef_1 invoking unsafe UDF. -CREATE VIEW view_sidef_1 AS SELECT myfunc_int(10); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t1 SELECT * FROM view_sidef_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking view view_sidef_1 invoking unsafe UDF. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking view view_sidef_1 invoking unsafe UDF. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking view view_sidef_1 invoking unsafe UDF. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_sidef_2 invoking view view_sidef_1 invoking unsafe UDF. -CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP VIEW view_sidef_2; - -Invoking prepared statement prep_2 invoking view view_sidef_1 invoking unsafe UDF. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_sidef_1"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP VIEW view_sidef_1; - -Invoking prepared statement prep_1 invoking unsafe UDF. -PREPARE prep_1 FROM "INSERT INTO t0 VALUES (myfunc_int(10))"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_1; - -Invoking unsafe UDF. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t0 VALUES (myfunc_int(10)); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -==== Testing unsafeness of access to mysql.general_log ==== - -Invoking function func_sidef_1 invoking unsafe use of mysql.general_log. -CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t1 SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log. -CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP VIEW view_sidef_2; - -Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP FUNCTION func_sidef_1; - -Invoking procedure proc_1 invoking unsafe use of mysql.general_log. -CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT - -Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log. -PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PREPARE prep_2; -DROP PROCEDURE proc_1; - -Invoking trigger trig_1 invoking unsafe use of mysql.general_log. -CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_1 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log. -PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP TRIGGER trig_1; - -Invoking view view_retval_1 returning value from unsafe use of mysql.general_log. -CREATE VIEW view_retval_1 AS SELECT COUNT(*) FROM mysql.general_log; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t1 SELECT * FROM view_retval_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -* Invoke statement so that return value is dicarded: expect no warning. -SELECT * FROM view_retval_1; - -Invoking function func_sidef_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; RETURN 0; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END; -* binlog_format = STATEMENT: expect 1 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END; -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe use of mysql.general_log. -CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t2 SELECT * FROM view_retval_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -* Invoke statement so that return value is dicarded: expect no warning. -SELECT * FROM view_retval_2; -DROP VIEW view_retval_2; - -Invoking prepared statement prep_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_retval_1"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP VIEW view_retval_1; - -Invoking prepared statement prep_1 invoking unsafe use of mysql.general_log. -PREPARE prep_1 FROM "INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log"; -* binlog_format = STATEMENT: expect 1 warnings. -EXECUTE prep_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_1; - -Invoking unsafe use of mysql.general_log. -* binlog_format = STATEMENT: expect 1 warnings. -INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -* Invoke statement so that return value is dicarded: expect no warning. -SELECT COUNT(*) FROM mysql.general_log; - -==== Testing a statement that is unsafe in many ways ==== - -Invoking function func_sidef_1 invoking statement that is unsafe in many ways. -CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; RETURN 0; END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO t1 SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 6 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. -CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP VIEW view_sidef_2; - -Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 6 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP FUNCTION func_sidef_1; - -Invoking procedure proc_1 invoking statement that is unsafe in many ways. -CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END; -* binlog_format = STATEMENT: expect 6 warnings. -CALL proc_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 6 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. -PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 6 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP PROCEDURE proc_1; - -Invoking trigger trig_1 invoking statement that is unsafe in many ways. -CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO trigger_table_1 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 6 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) -master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 6 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. -PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 6 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP TRIGGER trig_1; - -Invoking prepared statement prep_1 invoking statement that is unsafe in many ways. -PREPARE prep_1 FROM "INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1"; -* binlog_format = STATEMENT: expect 6 warnings. -EXECUTE prep_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_1; - -Invoking statement that is unsafe in many ways. -* binlog_format = STATEMENT: expect 6 warnings. -INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -==== Testing a statement that is unsafe several times ==== - -Invoking function func_sidef_1 invoking statement that is unsafe several times. -CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); RETURN 0; END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t1 SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe several times. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe several times. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 2 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (test.ta0) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe several times. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe several times. -CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP VIEW view_sidef_2; - -Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe several times. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; -* binlog_format = STATEMENT: expect 2 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP FUNCTION func_sidef_1; - -Invoking procedure proc_1 invoking statement that is unsafe several times. -CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); END; -* binlog_format = STATEMENT: expect 2 warnings. -CALL proc_1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.ta0) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT - -Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe several times. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe several times. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 2 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.ta0) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe several times. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe several times. -PREPARE prep_2 FROM "CALL proc_1()"; -* binlog_format = STATEMENT: expect 2 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.ta0) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PREPARE prep_2; -DROP PROCEDURE proc_1; - -Invoking trigger trig_1 invoking statement that is unsafe several times. -CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO trigger_table_1 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe several times. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe several times. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 2 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) -master-bin.000001 # Table_map # # table_id: # (test.ta0) -master-bin.000001 # Table_map # # table_id: # (test.ta1) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe several times. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe several times. -PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; -* binlog_format = STATEMENT: expect 2 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP TRIGGER trig_1; - -Invoking view view_sidef_1 invoking statement that is unsafe several times. -CREATE VIEW view_sidef_1 AS SELECT multi_unsafe_func(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t1 SELECT * FROM view_sidef_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. - -Invoking function func_sidef_2 invoking view view_sidef_1 invoking statement that is unsafe several times. -CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; RETURN 0; END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t2 SELECT func_sidef_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP FUNCTION func_sidef_2; - -Invoking procedure proc_2 invoking view view_sidef_1 invoking statement that is unsafe several times. -CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END; -* binlog_format = STATEMENT: expect 2 warnings. -CALL proc_2(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -Failure! Event number 3 was a 'Query', not a 'Table_map'. -SHOW BINLOG EVENTS FROM <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Table_map # # table_id: # (test.t0) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -DROP PROCEDURE proc_2; - -Invoking trigger trig_2 invoking view view_sidef_1 invoking statement that is unsafe several times. -CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END; -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO trigger_table_2 VALUES (1); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER trig_2; - -Invoking view view_sidef_2 invoking view view_sidef_1 invoking statement that is unsafe several times. -CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO t2 SELECT * FROM view_sidef_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP VIEW view_sidef_2; - -Invoking prepared statement prep_2 invoking view view_sidef_1 invoking statement that is unsafe several times. -PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_sidef_1"; -* binlog_format = STATEMENT: expect 2 warnings. -EXECUTE prep_2; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_2; -DROP VIEW view_sidef_1; - -Invoking prepared statement prep_1 invoking statement that is unsafe several times. -PREPARE prep_1 FROM "INSERT INTO ta0 VALUES (multi_unsafe_func())"; -* binlog_format = STATEMENT: expect 2 warnings. -EXECUTE prep_1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP PREPARE prep_1; - -Invoking statement that is unsafe several times. -* binlog_format = STATEMENT: expect 2 warnings. -INSERT INTO ta0 VALUES (multi_unsafe_func()); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -* SQL_LOG_BIN = 0: expect nothing logged and no warning. -* binlog_format = MIXED: expect row events in binlog and no warning. -DROP TRIGGER double_autoinc_trig; -DROP TABLE t0, t1, t2, t3, ta0, ta1, ta2, ta3, -autoinc_table, double_autoinc_table, -data_table, -trigger_table_1, trigger_table_2, trigger_table_3; -DROP FUNCTION myfunc_int; -DROP FUNCTION multi_unsafe_func; -==== Special system variables that should *not* be unsafe ==== -CREATE TABLE t1 (a VARCHAR(1000)); -CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT); -INSERT INTO t1 VALUES (@@session.auto_increment_increment); -INSERT INTO t1 VALUES (@@session.auto_increment_offset); -INSERT INTO t1 VALUES (@@session.character_set_client); -INSERT INTO t1 VALUES (@@session.character_set_connection); -INSERT INTO t1 VALUES (@@session.character_set_database); -INSERT INTO t1 VALUES (@@session.character_set_server); -INSERT INTO t1 VALUES (@@session.collation_connection); -INSERT INTO t1 VALUES (@@session.collation_database); -INSERT INTO t1 VALUES (@@session.collation_server); -INSERT INTO t1 VALUES (@@session.foreign_key_checks); -INSERT INTO t1 VALUES (@@session.identity); -INSERT INTO t1 VALUES (@@session.last_insert_id); -INSERT INTO t1 VALUES (@@session.lc_time_names); -INSERT INTO t1 VALUES (@@session.pseudo_thread_id); -INSERT INTO t1 VALUES (@@session.sql_auto_is_null); -INSERT INTO t1 VALUES (@@session.timestamp); -INSERT INTO t1 VALUES (@@session.time_zone); -INSERT INTO t1 VALUES (@@session.unique_checks); -SET @my_var= 4711; -INSERT INTO t1 VALUES (@my_var); -SET insert_id= 12; -INSERT INTO autoinc_table VALUES (NULL); -The following variables *should* give a warning, despite they are replicated. -INSERT INTO t1 VALUES (@@session.sql_mode); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -INSERT INTO t1 VALUES (@@session.insert_id); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -DROP TABLE t1, autoinc_table; -CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b)); -INSERT INTO t1 SELECT * FROM t1 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -REPLACE INTO t1 SELECT * FROM t1 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -UPDATE t1 SET a=1 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -DELETE FROM t1 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -CREATE PROCEDURE p1() -BEGIN -INSERT INTO t1 SELECT * FROM t1 LIMIT 1; -REPLACE INTO t1 SELECT * FROM t1 LIMIT 1; -UPDATE t1 SET a=1 LIMIT 1; -DELETE FROM t1 LIMIT 1; -END| -CALL p1(); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -DROP PROCEDURE p1; -DROP TABLE t1; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100)); -INSERT INTO t1 VALUES ('a','b'); -UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -DROP TABLE t1; -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1(i INT PRIMARY KEY); -CREATE TABLE t2(i INT PRIMARY KEY); -CREATE TABLE t3(i INT, ch CHAR(50)); -"Should issue message Statement may not be safe to log in statement format." -INSERT INTO t1 SELECT * FROM t2 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -CREATE FUNCTION func6() -RETURNS INT -BEGIN -INSERT INTO t1 VALUES (10); -INSERT INTO t1 VALUES (11); -INSERT INTO t1 VALUES (12); -RETURN 0; -END| -"Should issue message Statement may not be safe to log in statement format only once" -INSERT INTO t3 VALUES(func6(), UUID()); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. -"Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements" -CREATE FUNCTION fun_check_log_bin() RETURNS INT -BEGIN -SET @@SQL_LOG_BIN = 0; -INSERT INTO t1 VALUES(@@global.sync_binlog); -RETURN 100; -END| -"One unsafe warning should be issued in the following statement" -SELECT fun_check_log_bin(); -fun_check_log_bin() -100 -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -"SQL_LOG_BIN should be ON still" -SHOW VARIABLES LIKE "SQL_LOG_BIN"; -Variable_name Value -sql_log_bin ON -set @save_log_bin = @@SESSION.SQL_LOG_BIN; -set @@SESSION.SQL_LOG_BIN = 0; -"Should NOT have any warning message issued in the following statements" -INSERT INTO t1 SELECT * FROM t2 LIMIT 1; -DROP TABLE t1,t2; -"Should NOT have any warning message issued in the following func7() and trig" -CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a CHAR(40)); -CREATE TABLE trigger_table (a CHAR(7)); -CREATE FUNCTION func7() -RETURNS INT -BEGIN -INSERT INTO t1 VALUES (@@global.sync_binlog); -INSERT INTO t1 VALUES (@@session.insert_id); -INSERT INTO t2 SELECT UUID(); -INSERT INTO t2 VALUES (@@session.sql_mode); -INSERT INTO t2 VALUES (@@global.init_slave); -RETURN 0; -END| -SHOW VARIABLES LIKE "SQL_LOG_BIN"; -Variable_name Value -sql_log_bin OFF -SELECT func7(); -func7() -0 ----- Insert from trigger ---- -CREATE TRIGGER trig -BEFORE INSERT ON trigger_table -FOR EACH ROW -BEGIN -INSERT INTO t1 VALUES (@@global.sync_binlog); -INSERT INTO t1 VALUES (@@session.insert_id); -INSERT INTO t1 VALUES (@@global.auto_increment_increment); -INSERT INTO t2 SELECT UUID(); -INSERT INTO t2 VALUES (@@session.sql_mode); -INSERT INTO t2 VALUES (@@global.init_slave); -INSERT INTO t2 VALUES (@@hostname); -END| -INSERT INTO trigger_table VALUES ('bye.'); -DROP FUNCTION fun_check_log_bin; -DROP FUNCTION func6; -DROP FUNCTION func7; -DROP TRIGGER trig; -DROP TABLE t1, t2, t3, trigger_table; -set @@SESSION.SQL_LOG_BIN = @save_log_bin; -SET @save_sql_mode = @@SESSION.SQL_MODE; -SET @@SESSION.SQL_MODE = STRICT_ALL_TABLES; -CREATE TABLE t1(i INT PRIMARY KEY); -CREATE TABLE t2(i INT PRIMARY KEY); -INSERT INTO t1 SELECT * FROM t2 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -INSERT INTO t1 VALUES(@@global.sync_binlog); -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave. -UPDATE t1 SET i = 999 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -DELETE FROM t1 LIMIT 1; -Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. -DROP TABLE t1, t2; -SET @@SESSION.SQL_MODE = @save_sql_mode; -SET @old_binlog_format = @@session.binlog_format; -SET binlog_format = MIXED; -CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a INT); -INSERT INTO t2 VALUES (1), (2); -CREATE PROCEDURE proc_insert_delayed () -BEGIN -INSERT DELAYED INTO t1 VALUES (1), (2); -END| -CREATE FUNCTION func_limit () -RETURNS INT -BEGIN -INSERT INTO t1 SELECT * FROM t2 LIMIT 1; -RETURN 1; -END| -RESET MASTER; -CALL proc_insert_delayed(); -SELECT func_limit(); -func_limit() -1 -show binlog events from <binlog_start>; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -master-bin.000001 # Query # # BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # COMMIT -SET @@session.binlog_format = @old_binlog_format; -DROP TABLE t1, t2; -DROP PROCEDURE proc_insert_delayed; -DROP FUNCTION func_limit; -CREATE TABLE t1 (a INT, b INT PRIMARY KEY AUTO_INCREMENT); -CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT); -CREATE FUNCTION func_modify_t1 () -RETURNS INT -BEGIN -INSERT INTO t1 SET a = 1; -RETURN 0; -END| -# The following statement causes auto-incrementation -# of both t1 and t2. It is logged in statement format, -# so it should produce unsafe warning. -INSERT INTO t2 SET a = func_modify_t1(); -Warnings: -Note 1592 Statement may not be safe to log in statement format. -SET SESSION binlog_format = MIXED; -# Check if the statement is logged in row format. -INSERT INTO t2 SET a = func_modify_t1(); -SHOW BINLOG EVENTS FROM 12283; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 12283 Query 1 12351 BEGIN -master-bin.000001 12351 Table_map 1 12393 table_id: 44 (test.t2) -master-bin.000001 12393 Table_map 1 12435 table_id: 45 (test.t1) -master-bin.000001 12435 Write_rows 1 12473 table_id: 45 -master-bin.000001 12473 Write_rows 1 12511 table_id: 44 flags: STMT_END_F -master-bin.000001 12511 Query 1 12580 COMMIT -DROP TABLE t1,t2; -DROP FUNCTION func_modify_t1; -SET SESSION binlog_format = STATEMENT; -CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT); -CREATE TABLE t3 (a INT, b INT PRIMARY KEY AUTO_INCREMENT); -create trigger tri_modify_two_tables before insert on t1 for each row begin -insert into t2(a) values(new.a); -insert into t3(a) values(new.a); -end | -# The following statement causes auto-incrementation -# of both t2 and t3. It is logged in statement format, -# so it should produce unsafe warning -INSERT INTO t1 SET a = 1; -Warnings: -Note 1592 Statement may not be safe to log in statement format. -SET SESSION binlog_format = MIXED; -# Check if the statement is logged in row format. -INSERT INTO t1 SET a = 2; -SHOW BINLOG EVENTS FROM 13426; +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +Failure! Expected 0 warnings, got 1 warnings. +SHOW WARNINGS; +Level Code Message +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. +SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 13426 Query 1 13494 BEGIN -master-bin.000001 13494 Table_map 1 13535 table_id: 47 (test.t1) -master-bin.000001 13535 Table_map 1 13577 table_id: 48 (test.t3) -master-bin.000001 13577 Table_map 1 13619 table_id: 49 (test.t2) -master-bin.000001 13619 Write_rows 1 13657 table_id: 49 -master-bin.000001 13657 Write_rows 1 13695 table_id: 48 -master-bin.000001 13695 Write_rows 1 13729 table_id: 47 flags: STMT_END_F -master-bin.000001 13729 Query 1 13798 COMMIT -DROP TABLE t1,t2,t3; -"End of tests" +master-bin.000001 4 Format_desc 1 107 Server ver: 5.1.42-debug-log, Binlog ver: 4 +master-bin.000001 107 Query 1 175 BEGIN +master-bin.000001 175 Table_map 1 218 table_id: 34 (test.t0) +master-bin.000001 218 Write_rows 1 253 table_id: 34 flags: STMT_END_F +master-bin.000001 253 Query 1 322 COMMIT +master-bin.000001 322 Query 1 577 use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `func_sidef_1`() RETURNS varchar(100) CHARSET latin1 +BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); RETURN 0; END +master-bin.000001 577 Query 1 645 BEGIN +master-bin.000001 645 Intvar 1 673 INSERT_ID=1 +master-bin.000001 673 Query 1 772 use `test`; INSERT INTO t1 SELECT func_sidef_1() +master-bin.000001 772 Query 1 841 COMMIT diff --git a/mysql-test/suite/binlog/t/binlog_stm_do_db.test b/mysql-test/suite/binlog/t/binlog_stm_do_db.test index 858bc8cc683101d980a4fbcc3cf9b6809642f5f6..991fdef1beae4c1865b53a122978015f3992cddb 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_do_db.test +++ b/mysql-test/suite/binlog/t/binlog_stm_do_db.test @@ -74,11 +74,11 @@ INSERT INTO t1 SELECT * FROM t2; -- echo ### assertion: the statements *will* raise log error because -- echo ### binlog-do-db is not filtering used database BEGIN; --- error ER_BINLOG_LOGGING_IMPOSSIBLE +-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE INSERT INTO t2 VALUES (1,2), (1,3), (1,4); --- error ER_BINLOG_LOGGING_IMPOSSIBLE +-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE -- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2 --- error ER_BINLOG_LOGGING_IMPOSSIBLE +-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE INSERT INTO t1 SELECT * FROM t2; COMMIT; diff --git a/mysql-test/suite/rpl/r/rpl_insert_id.result b/mysql-test/suite/rpl/r/rpl_insert_id.result index e171e247b6c75da4a07a9dc1d15ae9f27ae06751..90d712e0a5233f8f377b18ef33b36f9112d56bfa 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_id.result +++ b/mysql-test/suite/rpl/r/rpl_insert_id.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); # # Setup # @@ -531,3 +532,4 @@ id last_id drop table t1, t2; drop procedure foo; SET @@global.concurrent_insert= @old_concurrent_insert; +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 533c8c1a42e506744077cc92e6d9b7cdf6e4fe1e..410d56f9988cf7629459dda9fe84c67a780bc1e8 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -606,9 +606,6 @@ end master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`() master-bin.000001 # Query # # COMMIT -set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators; -Warnings: -Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; drop database mysqltest; diff --git a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result index 52e2aa55465fe9bbf6b64234ff870a110f8ddba8..2924c606bd957cefe9663b187d98eb6c81ccf04c 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result +++ b/mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result @@ -43,8 +43,7 @@ RETURN i; END// CALL p1(); Warnings: -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN @@ -130,8 +129,7 @@ id DROP TRIGGER tr1; CALL p2(); Warnings: -Note 1592 Statement may not be safe to log in statement format. -Note 1592 Statement may not be safe to log in statement format. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave. show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # BEGIN @@ -211,3 +209,4 @@ DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/r/rpl_variables_stm.result b/mysql-test/suite/rpl/r/rpl_variables_stm.result index 514841872156648fe44cb3c18245696dbfd27b25..65a09b2e8b9fd7e943286ff00d42259095f0b30e 100644 --- a/mysql-test/suite/rpl/r/rpl_variables_stm.result +++ b/mysql-test/suite/rpl/r/rpl_variables_stm.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); ==== Initialization ==== [on master] SET @m_pseudo_thread_id= @@global.pseudo_thread_id; diff --git a/mysql-test/suite/rpl/t/rpl_insert_id.test b/mysql-test/suite/rpl/t/rpl_insert_id.test index 45cc32c9d39089379b158906772d3a99c288015a..d160f285520be996b3e6a551aed2dfb089dd00b6 100644 --- a/mysql-test/suite/rpl/t/rpl_insert_id.test +++ b/mysql-test/suite/rpl/t/rpl_insert_id.test @@ -9,3 +9,4 @@ -- source include/have_innodb.inc let $engine_type=myisam; -- source extra/rpl_tests/rpl_insert_id.test +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test b/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test index a8139bbbcd225dd6f1d29ec272c2867b97406d08..299def225d09ccd80d86ac21530f729d80c33e4c 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test +++ b/mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test @@ -108,3 +108,5 @@ DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; enable_warnings; sync_slave_with_master; + +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); diff --git a/mysql-test/suite/rpl/t/rpl_variables_stm.test b/mysql-test/suite/rpl/t/rpl_variables_stm.test index 67f2e50e041621e0fc3efc80c28054189962c484..e237189b36bf550da1776a0d119cac6d3bfb36d5 100644 --- a/mysql-test/suite/rpl/t/rpl_variables_stm.test +++ b/mysql-test/suite/rpl/t/rpl_variables_stm.test @@ -55,6 +55,7 @@ source include/master-slave.inc; source include/have_binlog_format_mixed_or_statement.inc; +call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT"); --echo ==== Initialization ==== @@ -377,8 +378,9 @@ BEGIN END| DELIMITER ;| +--disable_warnings SELECT func(); - +--enable_warnings --echo ==== Insert variables from a trigger ==== diff --git a/sql/slave.cc b/sql/slave.cc index 5340cc6fb8aed445ce063646eee761fa21ce8268..c58d9738950d3123dd04c9f608e9c262c5c68ff0 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1488,199 +1488,6 @@ when it try to get the value of TIME_ZONE global variable from master."; DBUG_RETURN(2); } -/* - Used by fetch_master_table (used by LOAD TABLE tblname FROM MASTER and LOAD - DATA FROM MASTER). Drops the table (if 'overwrite' is true) and recreates it - from the dump. Honours replication inclusion/exclusion rules. - db must be non-zero (guarded by assertion). - - RETURN VALUES - 0 success - 1 error -*/ - -static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, - const char* table_name, bool overwrite) -{ - ulong packet_len; - char *query, *save_db; - uint32 save_db_length; - Vio* save_vio; - HA_CHECK_OPT check_opt; - TABLE_LIST tables; - int error= 1; - handler *file; - ulonglong save_options; - NET *net= &mysql->net; - const char *found_semicolon= NULL; - DBUG_ENTER("create_table_from_dump"); - - packet_len= my_net_read(net); // read create table statement - if (packet_len == packet_error) - { - my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0)); - DBUG_RETURN(1); - } - if (net->read_pos[0] == 255) // error from master - { - char *err_msg; - err_msg= (char*) net->read_pos + ((mysql->server_capabilities & - CLIENT_PROTOCOL_41) ? - 3+SQLSTATE_LENGTH+1 : 3); - my_error(ER_MASTER, MYF(0), err_msg); - DBUG_RETURN(1); - } - thd->command = COM_TABLE_DUMP; - if (!(query = thd->strmake((char*) net->read_pos, packet_len))) - { - sql_print_error("create_table_from_dump: out of memory"); - my_message(ER_GET_ERRNO, "Out of memory", MYF(0)); - DBUG_RETURN(1); - } - thd->set_query(query, packet_len); - thd->is_slave_error = 0; - - bzero((char*) &tables,sizeof(tables)); - tables.db = (char*)db; - tables.alias= tables.table_name= (char*)table_name; - - /* Drop the table if 'overwrite' is true */ - if (overwrite) - { - if (mysql_rm_table(thd,&tables,1,0)) /* drop if exists */ - { - sql_print_error("create_table_from_dump: failed to drop the table"); - goto err; - } - else - { - /* Clear the OK result of mysql_rm_table(). */ - thd->main_da.reset_diagnostics_area(); - } - } - - /* Create the table. We do not want to log the "create table" statement */ - save_options = thd->options; - thd->options &= ~ (OPTION_BIN_LOG); - thd_proc_info(thd, "Creating table from master dump"); - // save old db in case we are creating in a different database - save_db = thd->db; - save_db_length= thd->db_length; - thd->db = (char*)db; - DBUG_ASSERT(thd->db != 0); - thd->db_length= strlen(thd->db); - /* run create table */ - mysql_parse(thd, thd->query(), packet_len, &found_semicolon); - thd->db = save_db; // leave things the way the were before - thd->db_length= save_db_length; - thd->options = save_options; - - if (thd->is_slave_error) - goto err; // mysql_parse took care of the error send - - thd_proc_info(thd, "Opening master dump table"); - thd->main_da.reset_diagnostics_area(); /* cleanup from CREATE_TABLE */ - /* - Note: If this function starts to fail for MERGE tables, - change the next two lines to these: - tables.table= NULL; // was set by mysql_rm_table() - if (!open_n_lock_single_table(thd, &tables, TL_WRITE)) - */ - tables.lock_type = TL_WRITE; - if (!open_ltable(thd, &tables, TL_WRITE, 0)) - { - sql_print_error("create_table_from_dump: could not open created table"); - goto err; - } - - file = tables.table->file; - thd_proc_info(thd, "Reading master dump table data"); - /* Copy the data file */ - if (file->net_read_dump(net)) - { - my_message(ER_MASTER_NET_READ, ER(ER_MASTER_NET_READ), MYF(0)); - sql_print_error("create_table_from_dump: failed in\ - handler::net_read_dump()"); - goto err; - } - - check_opt.init(); - check_opt.flags|= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK; - thd_proc_info(thd, "Rebuilding the index on master dump table"); - /* - We do not want repair() to spam us with messages - just send them to the error log, and report the failure in case of - problems. - */ - save_vio = thd->net.vio; - thd->net.vio = 0; - /* Rebuild the index file from the copied data file (with REPAIR) */ - error=file->ha_repair(thd,&check_opt) != 0; - thd->net.vio = save_vio; - if (error) - my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name.str); - -err: - close_thread_tables(thd); - DBUG_RETURN(error); -} - - -int fetch_master_table(THD *thd, const char *db_name, const char *table_name, - Master_info *mi, MYSQL *mysql, bool overwrite) -{ - int error= 1; - const char *errmsg=0; - bool called_connected= (mysql != NULL); - DBUG_ENTER("fetch_master_table"); - DBUG_PRINT("enter", ("db_name: '%s' table_name: '%s'", - db_name,table_name)); - - if (!called_connected) - { - if (!(mysql = mysql_init(NULL))) - { - DBUG_RETURN(1); - } - if (connect_to_master(thd, mysql, mi)) - { - my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql)); - /* - We need to clear the active VIO since, theoretically, somebody - might issue an awake() on this thread. If we are then in the - middle of closing and destroying the VIO inside the - mysql_close(), we will have a problem. - */ -#ifdef SIGNAL_WITH_VIO_CLOSE - thd->clear_active_vio(); -#endif - mysql_close(mysql); - DBUG_RETURN(1); - } - if (thd->killed) - goto err; - } - - if (request_table_dump(mysql, db_name, table_name)) - { - error= ER_UNKNOWN_ERROR; - errmsg= "Failed on table dump request"; - goto err; - } - if (create_table_from_dump(thd, mysql, db_name, - table_name, overwrite)) - goto err; // create_table_from_dump have sent the error already - error = 0; - - err: - if (!called_connected) - mysql_close(mysql); - if (errmsg && thd->vio_ok()) - my_message(error, errmsg, MYF(0)); - DBUG_RETURN(test(error)); // Return 1 on error -} - - static bool wait_for_relay_log_space(Relay_log_info* rli) { bool slave_killed=0;