mariadb/mysql-test/suite/binlog/r/binlog_unsafe.result
2009-12-17 21:43:35 +00:00

3274 lines
210 KiB
Text

#### 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 binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT func_retval_1();
Invoking function func_retval_2 returning value from function func_retval_1 returning value from unsafe UUID() function.
CREATE FUNCTION func_retval_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); RETURN func_retval_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 VALUES (func_retval_2());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT func_retval_2();
DROP FUNCTION func_retval_2;
Invoking function func_sidef_2 invoking function func_retval_1 returning value from unsafe UUID() function.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe UUID() function.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe UUID() function.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe UUID() function.
CREATE VIEW view_retval_2 AS SELECT func_retval_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_2;
DROP VIEW view_retval_2;
Invoking prepared statement prep_2 invoking 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 binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_retval_1;
Invoking function func_sidef_1 invoking unsafe UUID() function.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe UUID() function.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe UUID() function.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe UUID() function.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe UUID() function.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe UUID() function.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe UUID() function.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe UUID() function.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe UUID() function.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe UUID() function.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe UUID() function.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking unsafe UUID() function.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (UUID()); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe UUID() function.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe UUID() function.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe UUID() function.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe UUID() function.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking view view_retval_1 returning value from unsafe UUID() function.
CREATE VIEW view_retval_1 AS SELECT UUID();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_1;
Invoking function func_sidef_2 invoking view view_retval_1 returning value from unsafe UUID() function.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe UUID() function.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe UUID() function.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe UUID() function.
CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_2;
DROP VIEW view_retval_2;
Invoking prepared statement prep_2 invoking view view_retval_1 returning value from unsafe UUID() function.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_retval_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP VIEW view_retval_1;
Invoking prepared statement prep_1 invoking unsafe UUID() function.
PREPARE prep_1 FROM "INSERT INTO t0 VALUES (UUID())";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking unsafe UUID() function.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 VALUES (UUID());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT UUID();
==== Testing @@hostname unsafeness ====
Invoking function func_retval_1 returning value from unsafe @@hostname variable.
CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); RETURN @@hostname; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 VALUES (func_retval_1());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT func_retval_1();
Invoking function func_retval_2 returning value from function func_retval_1 returning value from unsafe @@hostname variable.
CREATE FUNCTION func_retval_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); RETURN func_retval_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 VALUES (func_retval_2());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT func_retval_2();
DROP FUNCTION func_retval_2;
Invoking function func_sidef_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe @@hostname variable.
CREATE VIEW view_retval_2 AS SELECT func_retval_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_2;
DROP VIEW view_retval_2;
Invoking prepared statement prep_2 invoking function func_retval_1 returning value from unsafe @@hostname variable.
PREPARE prep_2 FROM "INSERT INTO t1 VALUES (func_retval_1())";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_retval_1;
Invoking function func_sidef_1 invoking unsafe @@hostname variable.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe @@hostname variable.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe @@hostname variable.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe @@hostname variable.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking unsafe @@hostname variable.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (@@hostname); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe @@hostname variable.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking prepared statement prep_1 invoking unsafe @@hostname variable.
PREPARE prep_1 FROM "INSERT INTO t0 VALUES (@@hostname)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking unsafe @@hostname variable.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 VALUES (@@hostname);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
==== Testing SELECT...LIMIT unsafeness ====
Invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe SELECT...LIMIT statement.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe SELECT...LIMIT statement.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT * FROM data_table LIMIT 1; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe SELECT...LIMIT statement.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
CREATE VIEW view_retval_1 AS SELECT * FROM data_table LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_1;
Invoking function func_sidef_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_2;
DROP VIEW view_retval_2;
Invoking prepared statement prep_2 invoking view view_retval_1 returning value from unsafe SELECT...LIMIT statement.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_retval_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP VIEW view_retval_1;
Invoking prepared statement prep_1 invoking unsafe SELECT...LIMIT statement.
PREPARE prep_1 FROM "INSERT INTO t0 SELECT * FROM data_table LIMIT 1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking unsafe SELECT...LIMIT statement.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 SELECT * FROM data_table LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM data_table LIMIT 1;
==== Testing INSERT DELAYED unsafeness ====
Invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe INSERT DELAYED statement.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe INSERT DELAYED statement.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO t0 VALUES (1), (2); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe INSERT DELAYED statement.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking prepared statement prep_1 invoking unsafe INSERT DELAYED statement.
PREPARE prep_1 FROM "INSERT DELAYED INTO t0 VALUES (1), (2)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking unsafe INSERT DELAYED statement.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT DELAYED INTO t0 VALUES (1), (2);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
==== Testing unsafeness of insert of two autoinc values ====
Invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe update of two autoinc columns.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe update of two autoinc columns.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking unsafe update of two autoinc columns.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO double_autoinc_table VALUES (NULL); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking prepared statement prep_1 invoking unsafe update of two autoinc columns.
PREPARE prep_1 FROM "INSERT INTO double_autoinc_table VALUES (NULL)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking unsafe update of two autoinc columns.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO double_autoinc_table VALUES (NULL);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
==== Testing unsafeness of UDF's ====
Invoking function func_retval_1 returning value from unsafe UDF.
CREATE FUNCTION func_retval_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); RETURN myfunc_int(10); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 VALUES (func_retval_1());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT func_retval_1();
Invoking function func_retval_2 returning value from function func_retval_1 returning value from unsafe UDF.
CREATE FUNCTION func_retval_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); RETURN func_retval_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 VALUES (func_retval_2());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT func_retval_2();
DROP FUNCTION func_retval_2;
Invoking function func_sidef_2 invoking function func_retval_1 returning value from unsafe UDF.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_retval_1 returning value from unsafe UDF.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_retval_1 returning value from unsafe UDF.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 VALUES (func_retval_1()); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from function func_retval_1 returning value from unsafe UDF.
CREATE VIEW view_retval_2 AS SELECT func_retval_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_2;
DROP VIEW view_retval_2;
Invoking prepared statement prep_2 invoking function func_retval_1 returning value from unsafe UDF.
PREPARE prep_2 FROM "INSERT INTO t1 VALUES (func_retval_1())";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_retval_1;
Invoking function func_sidef_1 invoking unsafe UDF.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe UDF.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe UDF.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe UDF.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe UDF.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe UDF.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe UDF.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe UDF.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe UDF.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe UDF.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe UDF.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking unsafe UDF.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 VALUES (myfunc_int(10)); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe UDF.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe UDF.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe UDF.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe UDF.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking view view_sidef_1 invoking unsafe UDF.
CREATE VIEW view_sidef_1 AS SELECT myfunc_int(10);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_sidef_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking view view_sidef_1 invoking unsafe UDF.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_sidef_1 invoking unsafe UDF.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_sidef_1 invoking unsafe UDF.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking view view_sidef_1 invoking unsafe UDF.
CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking view view_sidef_1 invoking unsafe UDF.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_sidef_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP VIEW view_sidef_1;
Invoking prepared statement prep_1 invoking unsafe UDF.
PREPARE prep_1 FROM "INSERT INTO t0 VALUES (myfunc_int(10))";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking unsafe UDF.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 VALUES (myfunc_int(10));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
==== Testing unsafeness of access to mysql.general_log ====
Invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking unsafe use of mysql.general_log.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking unsafe use of mysql.general_log.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
Invoking function func_sidef_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking unsafe use of mysql.general_log.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking unsafe use of mysql.general_log.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking unsafe use of mysql.general_log.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
CREATE VIEW view_retval_1 AS SELECT COUNT(*) FROM mysql.general_log;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t1 SELECT * FROM view_retval_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_1;
Invoking function func_sidef_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; RETURN 0; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_retval_1; END;
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_retval_2 returning value from view view_retval_1 returning value from unsafe use of mysql.general_log.
CREATE VIEW view_retval_2 AS SELECT * FROM view_retval_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t2 SELECT * FROM view_retval_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT * FROM view_retval_2;
DROP VIEW view_retval_2;
Invoking prepared statement prep_2 invoking view view_retval_1 returning value from unsafe use of mysql.general_log.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_retval_1";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP VIEW view_retval_1;
Invoking prepared statement prep_1 invoking unsafe use of mysql.general_log.
PREPARE prep_1 FROM "INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log";
* binlog_format = STATEMENT: expect 1 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking unsafe use of mysql.general_log.
* binlog_format = STATEMENT: expect 1 warnings.
INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
* Invoke statement so that return value is dicarded: expect no warning.
SELECT COUNT(*) FROM mysql.general_log;
==== Testing a statement that is unsafe in many ways ====
Invoking function func_sidef_1 invoking statement that is unsafe in many ways.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; RETURN 0; END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking statement that is unsafe in many ways.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe in many ways.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking statement that is unsafe in many ways.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 7 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table)
master-bin.000001 # Table_map # # table_id: # (test.autoinc_table)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 7 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe in many ways.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking prepared statement prep_1 invoking statement that is unsafe in many ways.
PREPARE prep_1 FROM "INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1";
* binlog_format = STATEMENT: expect 7 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking statement that is unsafe in many ways.
* binlog_format = STATEMENT: expect 7 warnings.
INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
==== Testing a statement that is unsafe several times ====
Invoking function func_sidef_1 invoking statement that is unsafe several times.
CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); RETURN 0; END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t1 SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.ta0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
CREATE VIEW view_sidef_2 AS SELECT func_sidef_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe several times.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP FUNCTION func_sidef_1;
Invoking procedure proc_1 invoking statement that is unsafe several times.
CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta0)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe several times.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe several times.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta0)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe several times.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe several times.
PREPARE prep_2 FROM "CALL proc_1()";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ta0)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PREPARE prep_2;
DROP PROCEDURE proc_1;
Invoking trigger trig_1 invoking statement that is unsafe several times.
CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_1 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe several times.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe several times.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1)
master-bin.000001 # Table_map # # table_id: # (test.ta0)
master-bin.000001 # Table_map # # table_id: # (test.ta1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe several times.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe several times.
PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP TRIGGER trig_1;
Invoking view view_sidef_1 invoking statement that is unsafe several times.
CREATE VIEW view_sidef_1 AS SELECT multi_unsafe_func();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t1 SELECT * FROM view_sidef_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
Invoking function func_sidef_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; RETURN 0; END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT func_sidef_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP FUNCTION func_sidef_2;
Invoking procedure proc_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
* binlog_format = STATEMENT: expect 2 warnings.
CALL proc_2();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
******** Failure! Event number 3 was a 'Query', not a 'Table_map'. ********
SHOW BINLOG EVENTS FROM <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (test.t0)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
DROP PROCEDURE proc_2;
Invoking trigger trig_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END;
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO trigger_table_2 VALUES (1);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER trig_2;
Invoking view view_sidef_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
CREATE VIEW view_sidef_2 AS SELECT * FROM view_sidef_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO t2 SELECT * FROM view_sidef_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP VIEW view_sidef_2;
Invoking prepared statement prep_2 invoking view view_sidef_1 invoking statement that is unsafe several times.
PREPARE prep_2 FROM "INSERT INTO t1 SELECT * FROM view_sidef_1";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_2;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_2;
DROP VIEW view_sidef_1;
Invoking prepared statement prep_1 invoking statement that is unsafe several times.
PREPARE prep_1 FROM "INSERT INTO ta0 VALUES (multi_unsafe_func())";
* binlog_format = STATEMENT: expect 2 warnings.
EXECUTE prep_1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP PREPARE prep_1;
Invoking statement that is unsafe several times.
* binlog_format = STATEMENT: expect 2 warnings.
INSERT INTO ta0 VALUES (multi_unsafe_func());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
* SQL_LOG_BIN = 0: expect nothing logged and no warning.
* binlog_format = MIXED: expect row events in binlog and no warning.
DROP TRIGGER double_autoinc_trig;
DROP TABLE t0, t1, t2, t3, ta0, ta1, ta2, ta3,
autoinc_table, double_autoinc_table,
data_table,
trigger_table_1, trigger_table_2, trigger_table_3;
DROP FUNCTION myfunc_int;
DROP FUNCTION multi_unsafe_func;
==== Special system variables that should *not* be unsafe ====
CREATE TABLE t1 (a VARCHAR(1000));
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
INSERT INTO t1 VALUES (@@session.auto_increment_increment);
INSERT INTO t1 VALUES (@@session.auto_increment_offset);
INSERT INTO t1 VALUES (@@session.character_set_client);
INSERT INTO t1 VALUES (@@session.character_set_connection);
INSERT INTO t1 VALUES (@@session.character_set_database);
INSERT INTO t1 VALUES (@@session.character_set_server);
INSERT INTO t1 VALUES (@@session.collation_connection);
INSERT INTO t1 VALUES (@@session.collation_database);
INSERT INTO t1 VALUES (@@session.collation_server);
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
INSERT INTO t1 VALUES (@@session.identity);
INSERT INTO t1 VALUES (@@session.last_insert_id);
INSERT INTO t1 VALUES (@@session.lc_time_names);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
INSERT INTO t1 VALUES (@@session.timestamp);
INSERT INTO t1 VALUES (@@session.time_zone);
INSERT INTO t1 VALUES (@@session.unique_checks);
SET @my_var= 4711;
INSERT INTO t1 VALUES (@my_var);
SET insert_id= 12;
INSERT INTO autoinc_table VALUES (NULL);
The following variables *should* give a warning, despite they are replicated.
INSERT INTO t1 VALUES (@@session.sql_mode);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
INSERT INTO t1 VALUES (@@session.insert_id);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
DROP TABLE t1, autoinc_table;
CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b));
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
UPDATE t1 SET a=1 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
CREATE PROCEDURE p1()
BEGIN
INSERT INTO t1 SELECT * FROM t1 LIMIT 1;
REPLACE INTO t1 SELECT * FROM t1 LIMIT 1;
UPDATE t1 SET a=1 LIMIT 1;
DELETE FROM t1 LIMIT 1;
END|
CALL p1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP PROCEDURE p1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
INSERT INTO t1 VALUES ('a','b');
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP TABLE t1;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
CREATE TABLE t3(i INT, ch CHAR(50));
"Should issue message Statement may not be safe to log in statement format."
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
CREATE FUNCTION func6()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (10);
INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12);
RETURN 0;
END|
"Should issue message Statement may not be safe to log in statement format only once"
INSERT INTO t3 VALUES(func6(), UUID());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
"Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN
SET @@SQL_LOG_BIN = 0;
INSERT INTO t1 VALUES(@@global.sync_binlog);
RETURN 100;
END|
"One unsafe warning should be issued in the following statement"
SELECT fun_check_log_bin();
fun_check_log_bin()
100
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
"SQL_LOG_BIN should be ON still"
SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name Value
sql_log_bin ON
set @save_log_bin = @@SESSION.SQL_LOG_BIN;
set @@SESSION.SQL_LOG_BIN = 0;
"Should NOT have any warning message issued in the following statements"
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
DROP TABLE t1,t2;
"Should NOT have any warning message issued in the following func7() and trig"
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a CHAR(40));
CREATE TABLE trigger_table (a CHAR(7));
CREATE FUNCTION func7()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
RETURN 0;
END|
SHOW VARIABLES LIKE "SQL_LOG_BIN";
Variable_name Value
sql_log_bin OFF
SELECT func7();
func7()
0
---- Insert from trigger ----
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
INSERT INTO trigger_table VALUES ('bye.');
DROP FUNCTION fun_check_log_bin;
DROP FUNCTION func6;
DROP FUNCTION func7;
DROP TRIGGER trig;
DROP TABLE t1, t2, t3, trigger_table;
set @@SESSION.SQL_LOG_BIN = @save_log_bin;
SET @save_sql_mode = @@SESSION.SQL_MODE;
SET @@SESSION.SQL_MODE = STRICT_ALL_TABLES;
CREATE TABLE t1(i INT PRIMARY KEY);
CREATE TABLE t2(i INT PRIMARY KEY);
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
INSERT INTO t1 VALUES(@@global.sync_binlog);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system variable whose value may differ on slave.
UPDATE t1 SET i = 999 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DELETE FROM t1 LIMIT 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
SET @old_binlog_format = @@session.binlog_format;
SET binlog_format = MIXED;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (1), (2);
CREATE PROCEDURE proc_insert_delayed ()
BEGIN
INSERT DELAYED INTO t1 VALUES (1), (2);
END|
CREATE FUNCTION func_limit ()
RETURNS INT
BEGIN
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
RETURN 1;
END|
RESET MASTER;
CALL proc_insert_delayed();
SELECT func_limit();
func_limit()
1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
SET @@session.binlog_format = @old_binlog_format;
DROP TABLE t1, t2;
DROP PROCEDURE proc_insert_delayed;
DROP FUNCTION func_limit;
CREATE TABLE t1 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
CREATE FUNCTION func_modify_t1 ()
RETURNS INT
BEGIN
INSERT INTO t1 SET a = 1;
RETURN 0;
END|
# The following statement causes auto-incrementation
# of both t1 and t2. It is logged in statement format,
# so it should produce unsafe warning.
INSERT INTO t2 SET a = func_modify_t1();
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
SET SESSION binlog_format = MIXED;
# Check if the statement is logged in row format.
INSERT INTO t2 SET a = func_modify_t1();
SHOW BINLOG EVENTS FROM 1493;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 1493 Query 1 1561 BEGIN
master-bin.000001 1561 Table_map 1 1603 table_id: 205 (test.t2)
master-bin.000001 1603 Table_map 1 1645 table_id: 206 (test.t1)
master-bin.000001 1645 Write_rows 1 1683 table_id: 206
master-bin.000001 1683 Write_rows 1 1721 table_id: 205 flags: STMT_END_F
master-bin.000001 1721 Query 1 1790 COMMIT
DROP TABLE t1,t2;
DROP FUNCTION func_modify_t1;
SET SESSION binlog_format = STATEMENT;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE t3 (a INT, b INT PRIMARY KEY AUTO_INCREMENT);
create trigger tri_modify_two_tables before insert on t1 for each row begin
insert into t2(a) values(new.a);
insert into t3(a) values(new.a);
end |
# The following statement causes auto-incrementation
# of both t2 and t3. It is logged in statement format,
# so it should produce unsafe warning
INSERT INTO t1 SET a = 1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
SET SESSION binlog_format = MIXED;
# Check if the statement is logged in row format.
INSERT INTO t1 SET a = 2;
SHOW BINLOG EVENTS FROM 2773;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 2773 Query 1 2841 BEGIN
master-bin.000001 2841 Table_map 1 2882 table_id: 208 (test.t1)
master-bin.000001 2882 Table_map 1 2924 table_id: 209 (test.t3)
master-bin.000001 2924 Table_map 1 2966 table_id: 210 (test.t2)
master-bin.000001 2966 Write_rows 1 3004 table_id: 210
master-bin.000001 3004 Write_rows 1 3042 table_id: 209
master-bin.000001 3042 Write_rows 1 3076 table_id: 208 flags: STMT_END_F
master-bin.000001 3076 Query 1 3145 COMMIT
DROP TABLE t1,t2,t3;
SET SESSION binlog_format = STATEMENT;
CREATE TABLE t1 (a VARCHAR(1000));
INSERT INTO t1 VALUES (CURRENT_USER());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (FOUND_ROWS());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (ROW_COUNT());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SESSION_USER());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SLEEP(1));
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SYSDATE());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (SYSTEM_USER());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (USER());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (UUID());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (UUID_SHORT());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
INSERT INTO t1 VALUES (VERSION());
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
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;
"End of tests"