List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:December 14 2009 2:33pm
Subject:bzr commit into mysql-5.1-rep+3 branch (sven.sandberg:3126) Bug#45827
View as plain text  
#At file:///home/sven/bzr/debug-max/5.1-rep%2B3/ based on revid:alfranio.correia@stripped

 3126 Sven Sandberg	2009-12-14
      Post-push fixes after wrong merge from 5.1->rep+2->rep+3.
      Problem: The test was written before BUG#45827 was fixed.
      The test contained code that assumed the wrong behavior,
      pre-BUG#45827. Then, the fix for BUG#45827 was merged
      from 5.1-rep+2 to 5.1-rep+3. Since the test case assumed
      the wrong behavior, it failed. This should have been fixed
      by making the test assume the correct behavior, but was
      fixed by updating the result file to assert failure.
      Fix 1: fix the test to assume correct behavior
      (post-BUG#45827), update result file.
      Fix 2: make test fail with 'die' instead of 'exit' when
      wrong behavior is detected. Thus, the test cannot be
      silenced with a wrong result file in case the behavior
      will change again.
     @ mysql-test/extra/rpl_tests/create_recursive_construct.inc
        Replaced 'exit' by 'die' to avoid similar
     @ mysql-test/suite/binlog/r/binlog_unsafe.result
        Updated result file.
     @ mysql-test/suite/binlog/t/binlog_unsafe.test
        Since BUG#45827 is now fixed, we need to update the test case
        in two places where it expects the wrong result because of
        BUG#45827.

    modified:
      mysql-test/extra/rpl_tests/create_recursive_construct.inc
      mysql-test/suite/binlog/r/binlog_unsafe.result
      mysql-test/suite/binlog/t/binlog_unsafe.test
=== modified file 'mysql-test/extra/rpl_tests/create_recursive_construct.inc'
--- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc	2009-10-18 03:57:38 +0000
+++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc	2009-12-14 14:33:03 +0000
@@ -296,10 +296,10 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`
   --eval $CRC_RET_stmt_sidef
   --let $n_warnings= `SHOW COUNT(*) WARNINGS`
   if (`SELECT '$n_warnings' != '$CRC_ARG_expected_number_of_warnings'`) {
-    --echo Failure! Expected $CRC_ARG_expected_number_of_warnings warnings, got $n_warnings warnings.
+    --echo ******** Failure! Expected $CRC_ARG_expected_number_of_warnings warnings, got $n_warnings warnings. ********
     SHOW WARNINGS;
     SHOW BINLOG EVENTS;
-    --exit
+    --die Wrong number of warnings.
   }
 
   # These queries are run without query log, to make result file more
@@ -313,17 +313,17 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`
   --eval $CRC_RET_stmt_sidef
   --let $n_warnings= `SHOW COUNT(*) WARNINGS`
   if (`SELECT '$n_warnings' != '0'`) {
-    --echo Failure! Expected 0 warnings, got $n_warnings warnings.
+    --echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ********
     SHOW WARNINGS;
     SHOW BINLOG EVENTS;
-    --exit
+    --die Wrong number of warnings.
   }
   --let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2)
   if (`SELECT '$binlog_event' != 'No such row'`) {
     --enable_query_log
-    --echo Failure! Something was written to the binlog despite SQL_LOG_BIN=0:
+    --echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ********
     SHOW BINLOG EVENTS;
-    --exit
+    --die Binlog not empty
   }
   SET SQL_LOG_BIN = 1;
 
@@ -333,17 +333,17 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`
   --eval $CRC_RET_stmt_sidef
   --let $n_warnings= `SHOW COUNT(*) WARNINGS`
   if (`SELECT '$n_warnings' != '0'`) {
-    --echo Failure! Expected 0 warnings, got $n_warnings warnings.
+    --echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ********
     SHOW WARNINGS;
     SHOW BINLOG EVENTS;
-    --exit
+    --die Warnings printed
   }
   # The first event is format_description, the second is
   # Query_event('BEGIN'), and the third should be our Table_map.
   --let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
   if (`SELECT '$event_type' != 'Table_map'`) {
     --enable_query_log
-    --echo Failure! Event number 3 was a '$event_type', not a 'Table_map'.
+    --echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
 
     # Currently, there is a bug causing some statements to be logged
     # partially in statement format. Hence, we don't fail here, we
@@ -352,7 +352,7 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`
     # we should instead execute:
     #--enable_query_log
     #SHOW BINLOG EVENTS;
-    #--exit
+    #--die Wrong events in binlog.
 
     # Here, we should really source
     # include/show_binlog_events.inc. But due to BUG#41913, that
@@ -386,7 +386,7 @@ if (`SELECT '$CRC_RET_sel_retval' != ''`
   #  --echo Failure! Expected 0 warnings, got $n_warnings warnings.
   #  SHOW WARNINGS;
   #  SHOW BINLOG EVENTS;
-  #  --exit
+  #  --die Wrong number of warnings.
   #}
 }
 

=== modified file 'mysql-test/suite/binlog/r/binlog_unsafe.result'
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result	2009-12-02 12:17:07 +0000
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result	2009-12-14 14:33:03 +0000
@@ -71,7 +71,7 @@ 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.
 * 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'.
+******** 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
@@ -147,7 +147,7 @@ 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.
 * 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'.
+******** 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
@@ -223,7 +223,7 @@ 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.
 * 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'.
+******** 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
@@ -287,7 +287,7 @@ 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.
 * 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'.
+******** 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
@@ -355,7 +355,7 @@ 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.
 * 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'.
+******** 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
@@ -465,7 +465,7 @@ 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 = 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'.
+******** 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
@@ -541,7 +541,7 @@ 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 = 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'.
+******** 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
@@ -617,7 +617,7 @@ 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 = 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'.
+******** 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
@@ -681,7 +681,7 @@ 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 = 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'.
+******** 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
@@ -765,7 +765,7 @@ 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.
 * 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'.
+******** 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
@@ -841,7 +841,7 @@ 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.
 * 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'.
+******** 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
@@ -905,7 +905,7 @@ 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.
 * 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'.
+******** 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
@@ -973,7 +973,7 @@ 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.
 * 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'.
+******** 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
@@ -1069,7 +1069,7 @@ Warnings:
 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.
 * 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'.
+******** 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
@@ -1145,7 +1145,7 @@ Warnings:
 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.
 * 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'.
+******** 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
@@ -1209,7 +1209,7 @@ Warnings:
 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.
 * 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'.
+******** 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
@@ -1268,24 +1268,1924 @@ Note	1592	Unsafe statement binlogged in 
 
 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.
+* 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 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	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
+* 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 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 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 1 warnings.
+CALL proc_2();
+Warnings:
+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.
+* 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	#	#	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.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 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 update of two autoinc columns.
+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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 update of two autoinc columns.
+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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 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 1 warnings.
+CALL proc_1();
+Warnings:
+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.
+* 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	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+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
+
+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 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 update of two autoinc columns.
+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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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	#	#	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	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+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 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 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 update of two autoinc columns.
+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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+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 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 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 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 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 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 1 warnings.
+CALL proc_2();
+Warnings:
+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.
+* 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	#	#	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.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 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 update of two autoinc columns.
+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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 unsafe update of two autoinc columns.
+PREPARE prep_1 FROM "INSERT INTO double_autoinc_table VALUES (NULL)";
+* 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 update of two autoinc columns.
+* binlog_format = STATEMENT: expect 1 warnings.
+INSERT INTO double_autoinc_table VALUES (NULL);
+Warnings:
+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.
+* 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	#	#	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)
+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	#	#	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)
+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	#	#	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
+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	#	#	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)
+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	#	#	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
+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	#	#	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)
+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	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+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
+
+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	#	#	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	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+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 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	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+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 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	#	#	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)
+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	#	#	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
+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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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	#	#	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)
+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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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.
+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.
+* 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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.
+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.
+* 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	#	#	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
+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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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.
+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.
+* 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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	#	#	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.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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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 7 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 updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by 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	#	#	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.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	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+master-bin.000001	#	Query	#	#	COMMIT
+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	#	#	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	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+master-bin.000001	#	Query	#	#	COMMIT
+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	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO ta1 VALUES (47)
+master-bin.000001	#	Query	#	#	COMMIT
+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	#	#	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.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	#	#	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)
+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	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.
+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 1493;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	1493	Query	1	1561	BEGIN
+master-bin.000001	1561	Table_map	1	1603	table_id: 205 (test.t2)
+master-bin.000001	1603	Table_map	1	1645	table_id: 206 (test.t1)
+master-bin.000001	1645	Write_rows	1	1683	table_id: 206
+master-bin.000001	1683	Write_rows	1	1721	table_id: 205 flags: STMT_END_F
+master-bin.000001	1721	Query	1	1790	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	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.
+SET SESSION binlog_format = MIXED;
+# Check if the statement is logged in row format.
+INSERT INTO t1 SET a = 2;
+SHOW BINLOG EVENTS FROM 2773;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	2773	Query	1	2841	BEGIN
+master-bin.000001	2841	Table_map	1	2882	table_id: 208 (test.t1)
+master-bin.000001	2882	Table_map	1	2924	table_id: 209 (test.t3)
+master-bin.000001	2924	Table_map	1	2966	table_id: 210 (test.t2)
+master-bin.000001	2966	Write_rows	1	3004	table_id: 210
+master-bin.000001	3004	Write_rows	1	3042	table_id: 209
+master-bin.000001	3042	Write_rows	1	3076	table_id: 208 flags: STMT_END_F
+master-bin.000001	3076	Query	1	3145	COMMIT
+DROP TABLE t1,t2,t3;
+"End of tests"

=== modified file 'mysql-test/suite/binlog/t/binlog_unsafe.test'
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test	2009-11-30 18:20:26 +0000
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test	2009-12-14 14:33:03 +0000
@@ -194,8 +194,7 @@ while (`SELECT $unsafe_type < 9`) {
     --let $value_0=
     --let $sel_sidef_0=
     --let $sel_retval_0=
-    # Note: we will expect 1 warning when BUG#45827 is fixed.
-    --let $CRC_ARG_expected_number_of_warnings= 0
+    --let $CRC_ARG_expected_number_of_warnings= 1
   }
 
   if (`SELECT $unsafe_type = 5`) {
@@ -227,8 +226,7 @@ while (`SELECT $unsafe_type < 9`) {
     --let $value_0=
     --let $sel_sidef_0=
     --let $sel_retval_0=
-    # Note: we will expect 7 warnings when BUG#45827 is fixed.
-    --let $CRC_ARG_expected_number_of_warnings= 6
+    --let $CRC_ARG_expected_number_of_warnings= 7
   }
 
   if (`SELECT $unsafe_type = 8`) {


Attachment: [text/bzr-bundle] bzr/sven.sandberg@sun.com-20091214143303-9dhrmi3rjh06a74y.bundle
Thread
bzr commit into mysql-5.1-rep+3 branch (sven.sandberg:3126) Bug#45827Sven Sandberg14 Dec