summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog/r/binlog_unsafe.result
diff options
context:
space:
mode:
authorAlfranio Correia <alfranio.correia@sun.com>2009-12-17 21:43:35 +0000
committerAlfranio Correia <alfranio.correia@sun.com>2009-12-17 21:43:35 +0000
commit3dadf9564cbfd6e584db282b9105b8f5fb38f99b (patch)
treefb25bfc9b6c669b42e70afadf7790f0f8d7db7e3 /mysql-test/suite/binlog/r/binlog_unsafe.result
parente852131f048df0c48d6779c40b23a347fbccc107 (diff)
parente83c9f627377f05e093f092cee227da1b43d8e94 (diff)
downloadmariadb-git-3dadf9564cbfd6e584db282b9105b8f5fb38f99b.tar.gz
merge mysql-5.1-rep+3 --> mysql-5.1-rep+2-delivery1
Diffstat (limited to 'mysql-test/suite/binlog/r/binlog_unsafe.result')
-rw-r--r--mysql-test/suite/binlog/r/binlog_unsafe.result3270
1 files changed, 3038 insertions, 232 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result
index c3ce1783f95..7845ec93b44 100644
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result
@@ -1,210 +1,2985 @@
-==== Setup tables ====
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a CHAR(40));
-CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE trigger_table (a CHAR(7));
-CREATE TABLE trigger_table2 (a INT);
-==== Non-deterministic statements ====
-INSERT DELAYED INTO t1 VALUES (5);
-==== Some variables that *should* be unsafe ====
----- Insert directly ----
-INSERT INTO t1 VALUES (@@global.sync_binlog);
+#### Setup tables ####
+CREATE TABLE t0 (a CHAR(100));
+CREATE TABLE t1 (a CHAR(100));
+CREATE TABLE t2 (a CHAR(100));
+CREATE TABLE t3 (a CHAR(100));
+CREATE TABLE ta0 (a CHAR(100));
+CREATE TABLE ta1 (a CHAR(100));
+CREATE TABLE ta2 (a CHAR(100));
+CREATE TABLE ta3 (a CHAR(100));
+CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TABLE data_table (a CHAR(100));
+INSERT INTO data_table VALUES ('foo');
+CREATE TABLE trigger_table_1 (a INT);
+CREATE TABLE trigger_table_2 (a INT);
+CREATE TABLE trigger_table_3 (a INT);
+CREATE TABLE double_autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
+CREATE TRIGGER double_autoinc_trig
+BEFORE INSERT ON double_autoinc_table FOR EACH ROW
+BEGIN
+INSERT INTO autoinc_table VALUES (NULL);
+END|
+CREATE FUNCTION multi_unsafe_func() RETURNS INT
+BEGIN
+INSERT INTO t0 VALUES(CONCAT(@@hostname, @@hostname));
+INSERT INTO t0 VALUES(0);
+INSERT INTO t0 VALUES(CONCAT(UUID(), @@hostname));
+RETURN 1;
+END|
+CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB";
+
+==== Testing UUID() unsafeness ====
+
+Invoking function func_retval_1 returning value from unsafe UUID() function.
+CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); RETURN UUID(); END;
+* binlog_format = STATEMENT: expect 1 warnings.
+INSERT INTO t1 VALUES (func_retval_1());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-INSERT INTO t1 VALUES (@@session.insert_id);
+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.
+* 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 UUID() function.
+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 Statement may not be safe to log in statement format.
-INSERT INTO t1 VALUES (@@global.auto_increment_increment);
+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.
+* 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 UUID() function.
+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 Statement may not be safe to log in statement format.
-INSERT INTO t2 SELECT UUID();
+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_retval_1 returning value from unsafe UUID() function.
+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 Statement may not be safe to log in statement format.
-INSERT INTO t2 VALUES (@@session.sql_mode);
+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 # 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 UUID() function.
+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 Statement may not be safe to log in statement format.
-INSERT INTO t2 VALUES (@@global.init_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_retval_2 returning value from function func_retval_1 returning value from unsafe UUID() function.
+CREATE VIEW view_retval_2 AS SELECT func_retval_1();
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-INSERT INTO t2 VALUES (@@hostname);
+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 1 warnings.
+INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
----- Insert from stored procedure ----
-CREATE PROCEDURE proc()
-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|
-CALL proc();
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
----- Insert from stored function ----
-CREATE FUNCTION func()
-RETURNS INT
-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);
-RETURN 0;
-END|
-SELECT func();
-func()
-0
+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.
+* 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 UUID() function.
+PREPARE prep_2 FROM "INSERT INTO t1 VALUES (func_retval_1())";
+* binlog_format = STATEMENT: expect 1 warnings.
+EXECUTE prep_2;
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
----- 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.');
+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_retval_1;
+
+Invoking function func_sidef_1 invoking unsafe UUID() function.
+CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); RETURN 0; END;
+* binlog_format = STATEMENT: expect 1 warnings.
+INSERT INTO t1 SELECT func_sidef_1();
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
----- Insert from prepared statement ----
-PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
-PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
-PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)';
-PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()';
-PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
-PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
-PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
-EXECUTE p1;
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-EXECUTE p2;
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-EXECUTE p3;
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-EXECUTE p4;
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-EXECUTE p5;
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-EXECUTE p6;
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-EXECUTE p7;
-Warnings:
-Note 1592 Statement may not be safe to log in statement format.
----- Insert from nested call of triggers / functions / procedures ----
-CREATE PROCEDURE proc1()
-INSERT INTO trigger_table VALUES ('ha!')|
-CREATE FUNCTION func2()
-RETURNS INT
-BEGIN
-CALL proc1();
-RETURN 0;
-END|
-CREATE TRIGGER trig3
-BEFORE INSERT ON trigger_table2
-FOR EACH ROW
-BEGIN
-DECLARE tmp INT;
-SELECT func2() INTO tmp;
-END|
-CREATE PROCEDURE proc4()
-INSERT INTO trigger_table2 VALUES (1)|
-CREATE FUNCTION func5()
-RETURNS INT
-BEGIN
-CALL proc4;
-RETURN 0;
-END|
-PREPARE prep6 FROM 'SELECT func5()'|
-EXECUTE prep6;
-func5()
-0
+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 unsafe UUID() function.
+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 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-==== Variables that should *not* be unsafe ====
-INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
-INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
+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 unsafe UUID() function.
+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 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 # 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 UUID() function.
+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 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 unsafe UUID() function.
+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 function whose value 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 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 unsafe UUID() function.
+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 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 unsafe UUID() function.
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); 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 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 procedure proc_1 invoking unsafe UUID() function.
+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 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 unsafe UUID() function.
+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 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.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 UUID() function.
+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 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 unsafe UUID() function.
+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 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 PROCEDURE proc_1;
+
+Invoking trigger trig_1 invoking unsafe UUID() function.
+CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); 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 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 unsafe UUID() function.
+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 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 unsafe UUID() function.
+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 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.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 UUID() function.
+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 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 unsafe UUID() function.
+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 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_retval_1 returning value from unsafe UUID() function.
+CREATE VIEW view_retval_1 AS SELECT 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.
+* 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 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.
+* 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 UUID() function.
+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 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_retval_1 returning value from unsafe UUID() function.
+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 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 # 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 UUID() function.
+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 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_retval_2 returning value from view view_retval_1 returning value from unsafe UUID() function.
+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 a system function whose value 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 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.
+* 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 UUID() function.
+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 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_retval_1;
+
+Invoking prepared statement prep_1 invoking unsafe UUID() function.
+PREPARE prep_1 FROM "INSERT INTO t0 VALUES (UUID())";
+* 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 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 unsafe UUID() function.
+* binlog_format = STATEMENT: expect 1 warnings.
+INSERT INTO t0 VALUES (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.
+* 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 UUID();
+
+==== Testing @@hostname unsafeness ====
+
+Invoking function func_retval_1 returning value from unsafe @@hostname variable.
+CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); RETURN @@hostname; 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 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.
+* 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 @@hostname variable.
+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 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.
+* 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 @@hostname variable.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
+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 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'. ********
+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 @@hostname variable.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe @@hostname variable.
+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 system variable whose value 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 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.
+* 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 @@hostname variable.
+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 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.
+DROP PREPARE prep_2;
+DROP FUNCTION func_retval_1;
+
+Invoking function func_sidef_1 invoking unsafe @@hostname variable.
+CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); 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 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.
+
+Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
+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 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'. ********
+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 @@hostname variable.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
+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.
+* 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 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.
+DROP VIEW view_sidef_2;
+
+Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
+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 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.
+DROP PREPARE prep_2;
+DROP FUNCTION func_sidef_1;
+
+Invoking procedure proc_1 invoking unsafe @@hostname variable.
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); 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 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.
+
+Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
+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 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'. ********
+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 @@hostname variable.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
+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 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.
+DROP PREPARE prep_2;
+DROP PROCEDURE proc_1;
+
+Invoking trigger trig_1 invoking unsafe @@hostname variable.
+CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); 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 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.
+
+Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
+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 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'. ********
+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 @@hostname variable.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
+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 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.
+DROP PREPARE prep_2;
+DROP TRIGGER trig_1;
+
+Invoking prepared statement prep_1 invoking unsafe @@hostname variable.
+PREPARE prep_1 FROM "INSERT INTO t0 VALUES (@@hostname)";
+* 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 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.
+DROP PREPARE prep_1;
+
+Invoking unsafe @@hostname variable.
+* binlog_format = STATEMENT: expect 1 warnings.
+INSERT INTO t0 VALUES (@@hostname);
+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.
+
+==== Testing SELECT...LIMIT unsafeness ====
+
+Invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
+CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; 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 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.
+
+Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
+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 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'. ********
+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 SELECT...LIMIT statement.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
+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.
+* 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 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.
+DROP VIEW view_sidef_2;
+
+Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
+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 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.
+DROP PREPARE prep_2;
+DROP FUNCTION func_sidef_1;
+
+Invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; 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 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.
+
+Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
+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 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'. ********
+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 SELECT...LIMIT statement.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
+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 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.
+DROP PREPARE prep_2;
+DROP PROCEDURE proc_1;
+
+Invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
+CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; 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 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.
+
+Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
+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 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'. ********
+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 SELECT...LIMIT statement.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
+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 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.
+DROP PREPARE prep_2;
+DROP TRIGGER trig_1;
+
+Invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
+CREATE VIEW view_retval_1 AS SELECT * FROM data_table 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.
+* 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 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.
+* 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 SELECT...LIMIT statement.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
+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 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'. ********
+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 SELECT...LIMIT statement.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
+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 a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
+* 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 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.
+* 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 SELECT...LIMIT statement.
+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 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.
+DROP PREPARE prep_2;
+DROP VIEW view_retval_1;
+
+Invoking prepared statement prep_1 invoking unsafe SELECT...LIMIT statement.
+PREPARE prep_1 FROM "INSERT INTO t0 SELECT * FROM data_table LIMIT 1";
+* 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 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.
+DROP PREPARE prep_1;
+
+Invoking unsafe SELECT...LIMIT statement.
+* binlog_format = STATEMENT: expect 1 warnings.
+INSERT INTO t0 SELECT * FROM data_table 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.
+* 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 data_table LIMIT 1;
+
+==== Testing INSERT DELAYED unsafeness ====
+
+Invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
+CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); 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 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.
+
+Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
+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 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'. ********
+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 INSERT DELAYED statement.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
+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 INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
+* 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 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.
+DROP VIEW view_sidef_2;
+
+Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
+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 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.
+DROP PREPARE prep_2;
+DROP FUNCTION func_sidef_1;
+
+Invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
+CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); 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 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.
+
+Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
+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 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'. ********
+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 INSERT DELAYED statement.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
+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 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.
+DROP PREPARE prep_2;
+DROP PROCEDURE proc_1;
+
+Invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
+CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); 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 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.
+
+Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
+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 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.
+DROP FUNCTION func_sidef_2;
+
+Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
+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 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'. ********
+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 INSERT DELAYED statement.
+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 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.
+DROP TRIGGER trig_2;
+
+Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
+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 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.
+DROP PREPARE prep_2;
+DROP TRIGGER trig_1;
+
+Invoking prepared statement prep_1 invoking unsafe INSERT DELAYED statement.
+PREPARE prep_1 FROM "INSERT DELAYED INTO t0 VALUES (1), (2)";
+* 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 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.
+DROP PREPARE prep_1;
+
+Invoking unsafe INSERT DELAYED statement.
+* binlog_format = STATEMENT: expect 1 warnings.
+INSERT DELAYED INTO t0 VALUES (1), (2);
+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.
+
+==== Testing unsafeness of insert of two autoinc values ====
+
+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 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.
+* 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);
-INSERT INTO t1 VALUES (@@session.auto_increment_increment);
-INSERT INTO t1 VALUES (@@session.auto_increment_offset);
-INSERT INTO t2 VALUES (@@session.character_set_client);
-INSERT INTO t2 VALUES (@@session.collation_connection);
-INSERT INTO t2 VALUES (@@session.collation_server);
-INSERT INTO t2 VALUES (@@session.time_zone);
-INSERT INTO t2 VALUES (@@session.lc_time_names);
-INSERT INTO t2 VALUES (@@session.collation_database);
-INSERT INTO t2 VALUES (@@session.timestamp);
-INSERT INTO t2 VALUES (@@session.last_insert_id);
SET @my_var= 4711;
INSERT INTO t1 VALUES (@my_var);
-SET insert_id=12;
-INSERT INTO t3 VALUES (NULL);
-==== Clean up ====
-DROP PROCEDURE proc;
-DROP FUNCTION func;
-DROP TRIGGER trig;
-DROP PROCEDURE proc1;
-DROP FUNCTION func2;
-DROP TRIGGER trig3;
-DROP PROCEDURE proc4;
-DROP FUNCTION func5;
-DROP PREPARE prep6;
-DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
+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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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;
@@ -214,10 +2989,7 @@ DELETE FROM t1 LIMIT 1;
END|
CALL p1();
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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;
@@ -225,7 +2997,7 @@ 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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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);
@@ -234,7 +3006,7 @@ 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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
CREATE FUNCTION func6()
RETURNS INT
BEGIN
@@ -246,7 +3018,7 @@ 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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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
@@ -259,7 +3031,7 @@ SELECT fun_check_log_bin();
fun_check_log_bin()
100
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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
@@ -315,18 +3087,52 @@ 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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
UPDATE t1 SET i = 999 LIMIT 1;
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement 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 ()
@@ -340,18 +3146,18 @@ END|
# so it should produce unsafe warning.
INSERT INTO t2 SET a = func_modify_t1();
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+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 12283;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 12283 Query 1 12351 BEGIN
-master-bin.000001 12351 Table_map 1 12393 table_id: 44 (test.t2)
-master-bin.000001 12393 Table_map 1 12435 table_id: 45 (test.t1)
-master-bin.000001 12435 Write_rows 1 12473 table_id: 45
-master-bin.000001 12473 Write_rows 1 12511 table_id: 44 flags: STMT_END_F
-master-bin.000001 12511 Query 1 12580 COMMIT
+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;
@@ -367,74 +3173,74 @@ end |
# so it should produce unsafe warning
INSERT INTO t1 SET a = 1;
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+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 13426;
-Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 13426 Query 1 13494 BEGIN
-master-bin.000001 13494 Table_map 1 13535 table_id: 47 (test.t1)
-master-bin.000001 13535 Table_map 1 13577 table_id: 48 (test.t3)
-master-bin.000001 13577 Table_map 1 13619 table_id: 49 (test.t2)
-master-bin.000001 13619 Write_rows 1 13657 table_id: 49
-master-bin.000001 13657 Write_rows 1 13695 table_id: 48
-master-bin.000001 13695 Write_rows 1 13729 table_id: 47 flags: STMT_END_F
-master-bin.000001 13729 Query 1 13798 COMMIT
+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;
SET SESSION binlog_format = STATEMENT;
CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (FOUND_ROWS());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (ROW_COUNT());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SESSION_USER());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SLEEP(1));
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SYSDATE());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SYSTEM_USER());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (USER());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (UUID());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (UUID_SHORT());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (VERSION());
Warnings:
-Note 1592 Statement may not be safe to log in statement format.
+Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
DELETE FROM t1;
SET TIMESTAMP=1000000;
INSERT INTO t1 VALUES