GIF89a; Mini Shell

Mini Shell

Direktori : /usr/share/mysql-test/suite/binlog/r/
Upload File :
Current File : //usr/share/mysql-test/suite/binlog/r/binlog_unsafe.result

#### 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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t0 VALUES (UUID()); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t0 VALUES (@@hostname); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t0 SELECT * FROM data_table LIMIT 1; INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 safeness after BUG#54579 is fixed ====

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;
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 0 warnings.
INSERT INTO t1 SELECT func_sidef_1();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 0 warnings.
INSERT INTO t2 SELECT func_sidef_2();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 0 warnings.
CALL proc_2();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 0 warnings.
INSERT INTO trigger_table_2 VALUES (1);
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 0 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 0 warnings.
EXECUTE prep_2;
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 DELAYED INTO t0 VALUES (1), (2); INSERT INTO ta1 VALUES (47); END;
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 0 warnings.
CALL proc_1();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 0 warnings.
INSERT INTO t2 SELECT func_sidef_2();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 0 warnings.
CALL proc_2();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 0 warnings.
INSERT INTO trigger_table_2 VALUES (1);
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 0 warnings.
EXECUTE prep_2;
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 0 warnings.
INSERT INTO trigger_table_1 VALUES (1);
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 0 warnings.
INSERT INTO t2 SELECT func_sidef_2();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 0 warnings.
CALL proc_2();
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 0 warnings.
INSERT INTO trigger_table_2 VALUES (1);
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 0 warnings.
EXECUTE prep_2;
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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)";
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 0 warnings.
EXECUTE prep_1;
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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. 0 with ps-protocol.
INSERT DELAYED INTO t0 VALUES (1), (2);
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = MIXED: expect row events in binlog and no warning.
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead

==== 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;

Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 double_autoinc_table VALUES (NULL); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.

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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 VALUES (func_retval_1()); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t0 VALUES (myfunc_int(10)); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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);
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_sidef_1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT * FROM view_sidef_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t0 SELECT COUNT(*) FROM mysql.general_log; INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.

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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT * FROM view_retval_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; INSERT INTO ta1 VALUES (47); END;
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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";
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 8 warnings. 7 with ps-protocol.
INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1;
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses the general log, slow query log, or performance_schema table(s). This is unsafe because system tables may differ on slaves.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a UDF which may not return the same value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
* binlog_format = MIXED: expect row events in binlog and no warning.
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead

==== 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT func_sidef_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 ta0 VALUES (multi_unsafe_func()); INSERT INTO ta1 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 CALL proc_1(); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 trigger_table_1 VALUES (1); INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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();
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t1 SELECT * FROM view_sidef_1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 t1 SELECT * FROM view_sidef_1; INSERT INTO ta2 VALUES (47); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* 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 written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
* SQL_LOG_BIN = 0: expect nothing logged and only deprecation warnings.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER double_autoinc_trig;
DROP TABLE t0, t1, t2, t3, ta0, ta1, ta2, ta3,
autoinc_table, double_autoinc_table,
data_table,
trigger_table_1, trigger_table_2, trigger_table_3;
DROP FUNCTION myfunc_int;
DROP FUNCTION multi_unsafe_func;
==== Special system variables that should *not* be unsafe ====
CREATE TABLE t1 (a VARCHAR(1000));
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
INSERT INTO t1 VALUES (@@session.auto_increment_increment);
INSERT INTO t1 VALUES (@@session.auto_increment_offset);
INSERT INTO t1 VALUES (@@session.character_set_client);
INSERT INTO t1 VALUES (@@session.character_set_connection);
INSERT INTO t1 VALUES (@@session.character_set_database);
INSERT INTO t1 VALUES (@@session.character_set_server);
INSERT INTO t1 VALUES (@@session.collation_connection);
INSERT INTO t1 VALUES (@@session.collation_database);
INSERT INTO t1 VALUES (@@session.collation_server);
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
INSERT INTO t1 VALUES (@@session.identity);
INSERT INTO t1 VALUES (@@session.last_insert_id);
INSERT INTO t1 VALUES (@@session.lc_time_names);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
INSERT INTO t1 VALUES (@@session.timestamp);
INSERT INTO t1 VALUES (@@session.time_zone);
INSERT INTO t1 VALUES (@@session.unique_checks);
SET @my_var= 4711;
INSERT INTO t1 VALUES (@my_var);
SET insert_id= 12;
INSERT INTO autoinc_table VALUES (NULL);
The following variables *should* give a warning, despite they are replicated.
INSERT INTO t1 VALUES (@@session.sql_mode);
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
INSERT INTO t1 VALUES (@@session.insert_id);
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
DROP TABLE t1, autoinc_table;
CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.
UPDATE t1 SET a=1 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
CREATE PROCEDURE p1()
BEGIN
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
UPDATE t1 SET a=1 LIMIT 1;
DELETE FROM t1 LIMIT 1;
END|
CALL p1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.
DROP PROCEDURE p1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
INSERT INTO t1 VALUES ('a','b');
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP TABLE t1;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
CREATE TABLE t3(i INT, ch CHAR(50));
"Should issue message Statement may not be safe to log in statement format."
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
CREATE FUNCTION func6()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12);
RETURN 0;
END|
"Should issue message Statement may not be safe to log in statement format only once"
INSERT INTO t3 VALUES(func6(), UUID());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
"Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN
SET @@SQL_LOG_BIN = 0;
INSERT INTO t1 VALUES(@@global.sync_binlog);
RETURN 100;
END|
"One unsafe warning should be issued in the following statement"
SELECT fun_check_log_bin();
ERROR HY000: Cannot change the sql_log_bin inside a stored function or trigger
"SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name	Value
sql_log_bin	ON
set @save_log_bin = @@SESSION.SQL_LOG_BIN;
set @@SESSION.SQL_LOG_BIN = 0;
"Should NOT have any warning message issued in the following statements"
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
DROP TABLE t1,t2;
"Should NOT have any warning message issued in the following func7() and trig"
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a TEXT);
CREATE TABLE trigger_table (a CHAR(7));
CREATE FUNCTION func7()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
RETURN 0;
END|
SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name	Value
sql_log_bin	OFF
SELECT func7();
func7()
0
---- Insert from trigger ----
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
INSERT INTO trigger_table VALUES ('bye.');
DROP FUNCTION fun_check_log_bin;
DROP FUNCTION func6;
DROP FUNCTION func7;
DROP TRIGGER  trig;
DROP TABLE t1, t2, t3, trigger_table;
set @@SESSION.SQL_LOG_BIN = @save_log_bin;
SET @save_sql_mode = @@SESSION.SQL_MODE;
SET @@SESSION.SQL_MODE = STRICT_ALL_TABLES;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
INSERT INTO t1 VALUES(@@global.sync_binlog);
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave.
UPDATE t1 SET i = 999 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it 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|
Warnings:
Warning	1287	'INSERT DELAYED' is deprecated and will be removed in a future release. Please use INSERT instead
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
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	#	#	BEGIN
master-bin.000001	#	Query	#	#	use `test`; INSERT DELAYED INTO t1 VALUES (1), (2)
master-bin.000001	#	Query	#	#	COMMIT
master-bin.000001	#	Query	#	#	BEGIN
master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
master-bin.000001	#	Query	#	#	COMMIT
SET @@session.binlog_format = @old_binlog_format;
DROP TABLE t1, t2;
DROP PROCEDURE proc_insert_delayed;
DROP FUNCTION func_limit;
CREATE TABLE t1 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
CREATE FUNCTION func_modify_t1 ()
RETURNS INT
BEGIN
INSERT INTO t1 SET a = 1;
RETURN 0;
END|
# The following statement causes auto-incrementation  
# of both t1 and t2. It is logged in statement format, 
# so it should produce unsafe warning.
INSERT INTO t2 SET a = func_modify_t1();
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
SET SESSION binlog_format = MIXED;
# Check if the statement is logged in row format.
INSERT INTO t2 SET a = func_modify_t1();
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
master-bin.000001	#	Query	#	#	BEGIN
master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
master-bin.000001	#	Write_rows	#	#	table_id: #
master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
master-bin.000001	#	Query	#	#	COMMIT
DROP TABLE t1,t2;
DROP FUNCTION func_modify_t1;
SET SESSION binlog_format = STATEMENT;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE t3 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
create trigger tri_modify_two_tables before insert on t1 for each row begin
insert into t2(a) values(new.a);
insert into t3(a) values(new.a);
end |
# The following statement causes auto-incrementation  
# of both t2 and t3. It is logged in statement format, 
# so it should produce unsafe warning
INSERT INTO t1 SET a = 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly.
SET SESSION binlog_format = MIXED;
# Check if the statement is logged in row format.
INSERT INTO t1 SET a = 2;
include/show_binlog_events.inc
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	#	Table_map	#	#	table_id: # (test.t3)
master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
master-bin.000001	#	Table_map	#	#	table_id: # (test.t3)
master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
master-bin.000001	#	Write_rows	#	#	table_id: #
master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
master-bin.000001	#	Query	#	#	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	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (FOUND_ROWS());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (ROW_COUNT());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (SESSION_USER());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (SLEEP(1));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (SYSDATE());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (SYSTEM_USER());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (USER());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (UUID());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (UUID_SHORT());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (VERSION());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (RAND());
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (RANDOM_BYTES(16));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (AES_ENCRYPT('a', 'a'));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
INSERT INTO t1 VALUES (AES_DECRYPT('a', 'a'));
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
DELETE FROM t1;
SET TIMESTAMP=1000000;
INSERT INTO t1 VALUES
(CURDATE()),
(CURRENT_DATE()),
(CURRENT_TIME()),
(CURRENT_TIMESTAMP()),
(CURTIME()),
(LOCALTIME()),
(LOCALTIMESTAMP()),
(NOW()),
(UNIX_TIMESTAMP()),
(UTC_DATE()),
(UTC_TIME()),
(UTC_TIMESTAMP());
SELECT * FROM t1;
a
1970-01-12
1970-01-12
16:46:40
1970-01-12 16:46:40
16:46:40
1970-01-12 16:46:40
1970-01-12 16:46:40
1970-01-12 16:46:40
1000000
1970-01-12
13:46:40
1970-01-12 13:46:40
DROP TABLE t1;
CREATE TABLE filler_table (a INT, b INT);
INSERT INTO filler_table values (1,1),(1,2);
CREATE TABLE insert_table (a INT, b INT, PRIMARY KEY(a));
CREATE TABLE replace_table (a INT, b INT, PRIMARY KEY(a));
INSERT INTO replace_table values (1,1),(2,2);
CREATE TABLE update_table (a INT, b INT, PRIMARY KEY(a));
INSERT INTO update_table values (1,1),(2,2);
CREATE TABLE insert_2_keys (a INT UNIQUE KEY, b INT UNIQUE KEY) ENGINE = InnoDB;
INSERT INTO insert_2_keys values (1, 1);
INSERT IGNORE INTO insert_table SELECT * FROM filler_table;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
TRUNCATE TABLE insert_table;
INSERT INTO insert_table SELECT * FROM filler_table ON DUPLICATE KEY UPDATE a = 1;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... SELECT... ON DUPLICATE KEY UPDATE is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are updated. This order cannot be predicted and may differ on master and the slave.
TRUNCATE TABLE insert_table;
REPLACE INTO replace_table SELECT * FROM filler_table;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.
UPDATE IGNORE update_table SET a=2;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
CREATE TABLE create_ignore_test (a INT, b INT, PRIMARY KEY(b)) IGNORE SELECT * FROM filler_table;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. CREATE... IGNORE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
CREATE TABLE create_replace_test (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT * FROM filler_table;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.
CREATE TEMPORARY TABLE temp1 (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT * FROM filler_table;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.
INSERT INTO insert_2_keys VALUES (1, 2) 
ON DUPLICATE KEY UPDATE a=VALUES(a)+10, b=VALUES(b)+10;
Warnings:
Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE  on a table with more than one UNIQUE KEY is unsafe
DROP TABLE filler_table;
DROP TABLE insert_table;
DROP TABLE update_table;
DROP TABLE replace_table;
DROP TABLE create_ignore_test;
DROP TABLE create_replace_test;
DROP TABLE insert_2_keys;
"End of tests"

./BlackJoker Mini Shell 1.0