From f404c96e82cbd1fb5ca73026dd8ef1b1ba6801bc Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Wed, 22 Jul 2009 18:16:17 +0200 Subject: [PATCH] BUG#39934: Slave stops for engine that only support row-based logging This is a post-push fix addressing review requests and problems with extra warnings. Problem 1: The sub-statement where an unsafe warning was detected was printed as part of the warning. This was ok for statements that were unsafe due to, e.g., calls to UUID(), but did not make sense for statements that were unsafe because there was more than one autoincrement column (unsafeness in this case comes from the combination of several sub-statements). Fix 1: Instead of printing the sub-statement, print an explanation of why the statement is unsafe. Problem 2: When a recursive construct (i.e., stored proceure, stored function, trigger, view, prepared statement) contained several sub-statements, and at least one of them was unsafe, there would be one unsafeness warning per sub-statement - even for safe sub-statements. Fix 2: Ensure that each type of warning is printed at most once, by remembering throughout the execution of the statement which types of warnings have been printed. mysql-test/extra/rpl_tests/create_recursive_construct.inc: - Clarified comment per review request. - Added checks for the number of warnings in each invocation. mysql-test/extra/rpl_tests/rpl_insert_delayed.test: Per review request, replaced @@session.binlog_format by @@global.binlog_format, since INSERT DELAYED reads the global variable. (In this test case, the two variables have the same value, so the change is cosmetic.) mysql-test/r/sp_trans.result: updated result file mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result: updated result file mysql-test/suite/binlog/r/binlog_stm_ps.result: updated result file mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result: updated result file mysql-test/suite/binlog/r/binlog_unsafe.result: Updated result file. Note that duplicate warnings are now gone. mysql-test/suite/binlog/t/binlog_unsafe.test: - Added tests for: (1) a statement that is unsafe in many ways; (2) a statement that is unsafe in the same way several times. - Use -- style to invoke mysqltest commands. mysql-test/suite/rpl/r/rpl_stm_found_rows.result: updated result file mysql-test/suite/rpl/r/rpl_stm_loadfile.result: updated result file mysql-test/suite/rpl/t/rpl_mix_found_rows.test: Per review request, added comment explaining what the test case does (copied from rpl_stm_found_rows.test) mysql-test/suite/rpl/t/rpl_stm_found_rows.test: Clarified grammar in comment. mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result: Updated result file. sql/item_create.cc: Made set_stmt_unsafe take one parameter, describing the type of unsafeness. sql/sp_head.cc: Added unsafe_flags field and made it hold all the unsafe flags. sql/sp_head.h: - Removed the BINLOG_ROW_BASED_IF_MIXED flag from m_flags. Instead, we use the new unsafe_flags field to hold the unsafeness state of the sp. - Made propagate_attributes() copy all unsafe flags. sql/sql_base.cc: - Made LEX::set_stmt_unsafe() take an extra argument. - Made binlog_unsafe_warning_flags store the type of unsafeness. - Per review requests, clarified comments - Added DBUG printouts sql/sql_class.cc: - Made warnings be generated in issue_warnings() and call that from binlog_query(). Wrote issue_warnings(), which prints zero or more warnings, avoiding to print warnings more than once per statement. - Per review request, added @todo so that we remember to assert correct behavior in binlog_query. sql/sql_class.h: - Removed BINLOG_WARNING_PRINTED - Use [set|clear]_current_stmt_binlog_row_based() instead of modifying the flag directly. - added issue_unsafe_warnings() (only called from binlog_unsafe) - Per review request, improved some documentation. sql/sql_insert.cc: Added extra argument to LEX::set_stmt_unsafe() sql/sql_lex.h: - Added enum_binlog_stmt_unsafe, listing all types of unsafe statements. - Per review requests, improved many comments for member functions. - Added [get|set]_stmt_unsafe_flags(), which return/set all the unsafe flags for a statement. sql/sql_parse.cc: - Renamed binlog_warning_flags to binlog_unsafe_warning_flags. - Per review requests, improved comment. sql/sql_view.cc: Made views propagate all the new unsafe flags. sql/sql_yacc.yy: Added parameter to set_stmt_unsafe(). storage/innobase/handler/ha_innodb.cc: Per review requests, replaced DBUG_EXECUTE_IF() by DBUG_EVALUATE_IF(). --- .../rpl_tests/create_recursive_construct.inc | 56 +- .../extra/rpl_tests/rpl_insert_delayed.test | 16 +- mysql-test/r/sp_trans.result | 11 +- .../r/binlog_statement_insert_delayed.result | 4 +- .../suite/binlog/r/binlog_stm_ps.result | 2 +- .../binlog/r/binlog_stm_unsafe_warning.result | 8 +- .../suite/binlog/r/binlog_unsafe.result | 1699 ++++++++++------- mysql-test/suite/binlog/t/binlog_unsafe.test | 253 ++- .../suite/rpl/r/rpl_stm_found_rows.result | 4 +- .../suite/rpl/r/rpl_stm_loadfile.result | 5 +- .../suite/rpl/t/rpl_mix_found_rows.test | 8 + .../suite/rpl/t/rpl_stm_found_rows.test | 8 +- .../r/rpl_ndb_binlog_format_errors.result | 4 +- sql/item_create.cc | 12 +- sql/sp_head.cc | 13 +- sql/sp_head.h | 22 +- sql/sql_base.cc | 59 +- sql/sql_class.cc | 123 +- sql/sql_class.h | 100 +- sql/sql_insert.cc | 2 +- sql/sql_lex.h | 184 +- sql/sql_parse.cc | 21 +- sql/sql_view.cc | 4 +- sql/sql_yacc.yy | 17 +- storage/innobase/handler/ha_innodb.cc | 7 +- 25 files changed, 1674 insertions(+), 968 deletions(-) diff --git a/mysql-test/extra/rpl_tests/create_recursive_construct.inc b/mysql-test/extra/rpl_tests/create_recursive_construct.inc index 66c82de8b99..4e16853f559 100644 --- a/mysql-test/extra/rpl_tests/create_recursive_construct.inc +++ b/mysql-test/extra/rpl_tests/create_recursive_construct.inc @@ -15,12 +15,15 @@ # - With SQL_LOG_BIN = 1 and binlog_format = MIXED, to verify that it # writes row events to the binlog. # -# - If the recursive construct can be invoked so that it has no -# side-effects but it returns a value that may be nondeterministic, -# then it is invoked in such a way that the return value is -# discarded, with SQL_LOG_BIN = 1 and binlog_format = STATEMENT. -# In this case, no warning should be given and nothing should be -# written to the binlog. +# - In some cases, the recursive construct can be invoked so that it +# has no side-effects but returns a value that may be +# nondeterministic. An example is a function that returns UUID(). +# The function does not have side effects but its a return value +# that may differ on slave. Such statements are invoked so that +# the return value is discarded (e.g., SELECT func()), with +# SQL_LOG_BIN = 1 and binlog_format = STATEMENT. In this case, no +# warning should be given and nothing should be written to the +# binlog. # # This is an auxiliary file particularly targeted to being used by the # test binlog_unsafe. In this context, the purpose is to check how @@ -289,8 +292,15 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) { --eval $CRC_create } - --echo * binlog_format = STATEMENT: expect warning. + --echo * binlog_format = STATEMENT: expect $CRC_ARG_expected_number_of_warnings warnings. --eval $CRC_RET_stmt_sidef + --let $n_warnings= `SHOW COUNT(*) WARNINGS` + if (`SELECT '$n_warnings' != '$CRC_ARG_expected_number_of_warnings'`) { + --echo Failure! Expected $CRC_ARG_expected_number_of_warnings warnings, got $n_warnings warnings. + SHOW WARNINGS; + SHOW BINLOG EVENTS; + --exit + } # These queries are run without query log, to make result file more # readable. Debug info is only printed if something abnormal @@ -301,19 +311,33 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) { SET SQL_LOG_BIN = 0; RESET MASTER; --eval $CRC_RET_stmt_sidef + --let $n_warnings= `SHOW COUNT(*) WARNINGS` + if (`SELECT '$n_warnings' != '0'`) { + --echo Failure! Expected 0 warnings, got $n_warnings warnings. + SHOW WARNINGS; + SHOW BINLOG EVENTS; + --exit + } --let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2) if (`SELECT '$binlog_event' != 'No such row'`) { --enable_query_log --echo Failure! Something was written to the binlog despite SQL_LOG_BIN=0: SHOW BINLOG EVENTS; - --die + --exit } SET SQL_LOG_BIN = 1; --echo * binlog_format = MIXED: expect row events in binlog and no warning. SET binlog_format = MIXED; RESET MASTER; - --eval $CRC_RET_stmt_sidef + --eval $CRC_RET_stmt_sidef + --let $n_warnings= `SHOW COUNT(*) WARNINGS` + if (`SELECT '$n_warnings' != '0'`) { + --echo Failure! Expected 0 warnings, got $n_warnings warnings. + SHOW WARNINGS; + SHOW BINLOG EVENTS; + --exit + } # The first event is format_description, the second is # Query_event('BEGIN'), and the third should be our Table_map. --let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3) @@ -328,7 +352,7 @@ if (`SELECT '$CRC_RET_stmt_sidef' != ''`) { # we should instead execute: #--enable_query_log #SHOW BINLOG EVENTS; - #--die + #--exit # Here, we should really source # include/show_binlog_events.inc. But due to BUG#41913, that @@ -352,6 +376,18 @@ if (`SELECT '$CRC_RET_sel_retval' != ''`) { --disable_result_log --eval $CRC_RET_sel_retval --enable_result_log + + # Currently, due to a bug, we do get warnings here, so we don't + # fail. When the bug is fixed, we should execute the following. + + #--let $n_warnings= `SHOW COUNT(*) WARNINGS` + #if (`SELECT '$n_warnings' != '0'`) { + # --enable_query_log + # --echo Failure! Expected 0 warnings, got $n_warnings warnings. + # SHOW WARNINGS; + # SHOW BINLOG EVENTS; + # --exit + #} } #--echo debug: <<< max_table_size*2 end repeat; end| call bug14210_fill_table()| Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: delete from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 (a) values (repeat('a', 255)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t3 select a from t3 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system variable whose value may differ on slave. drop procedure bug14210_fill_table| create table t4 like t3| create procedure bug14210() diff --git a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result index f4c9e4091b9..2968dcffa20 100644 --- a/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result +++ b/mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result @@ -13,10 +13,10 @@ master-bin.000001 # Query # # use `test`; insert delayed into t1 values (300) master-bin.000001 # Query # # use `test`; FLUSH TABLES insert delayed into t1 values (null),(null),(null),(null); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert delayed into t1 values (null),(null),(null),(null) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. insert delayed into t1 values (null),(null),(400),(null); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert delayed into t1 values (null),(null),(400),(null) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted. select * from t1; a 207 diff --git a/mysql-test/suite/binlog/r/binlog_stm_ps.result b/mysql-test/suite/binlog/r/binlog_stm_ps.result index 97daba735b2..b01ef8929d9 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ps.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result @@ -11,7 +11,7 @@ prepare s from "insert into t1 select 100 limit ?"; set @a=100; execute s using @a; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: insert into t1 select 100 limit 100 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; create table t1 (a int) diff --git a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result index f6c8d6421bc..463da7b2bdf 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result +++ b/mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result @@ -4,10 +4,10 @@ CREATE TABLE t1 (a int, b int, primary key (a)); INSERT INTO t1 VALUES (1,2), (2,3); UPDATE t1 SET b='4' WHERE a=1 LIMIT 1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: UPDATE t1 SET b='4' WHERE a=1 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. DROP TABLE t1; ### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown SET SQL_LOG_BIN= 0; @@ -25,6 +25,10 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a int, b int, primary key (a)); INSERT INTO t1 VALUES (1,2), (2,3); UPDATE t1 SET b='4' WHERE a=1 LIMIT 1; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. DROP TABLE t1; DROP DATABASE b42851; diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index 685a0f9ef57..0243693c120 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -1,32 +1,41 @@ #### Setup tables #### -CREATE TABLE t0 (a CHAR(40)); -CREATE TABLE t1 (a CHAR(40)); -CREATE TABLE t2 (a CHAR(40)); -CREATE TABLE t3 (a CHAR(40)); -CREATE TABLE ta1 (a CHAR(40)); -CREATE TABLE ta2 (a CHAR(40)); -CREATE TABLE ta3 (a CHAR(40)); +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 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 TABLE data_table (a CHAR(40)); +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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -34,12 +43,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 VALUES (func_retval_2()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -48,24 +55,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -82,13 +85,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -96,12 +96,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_2` AS SELECT func_retval_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_retval_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -110,11 +109,10 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -122,37 +120,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -171,14 +161,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -186,25 +172,21 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_2` AS SELECT func_sidef_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_sidef_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -212,34 +194,29 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -258,24 +235,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -283,37 +256,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -332,26 +297,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -360,11 +319,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_1` AS SELECT UUID() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -372,22 +331,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -402,12 +359,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -415,11 +370,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_2` AS SELECT * FROM view_retval_1 -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t2 SELECT * FROM view_retval_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -428,10 +383,10 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -439,19 +394,19 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. INSERT INTO t0 VALUES (UUID()); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (UUID()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -461,11 +416,10 @@ SELECT UUID(); 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -473,12 +427,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 VALUES (func_retval_2()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -487,24 +439,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -521,13 +469,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -535,12 +480,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_2` AS SELECT func_retval_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_retval_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -549,11 +493,10 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -561,37 +504,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -610,14 +545,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -625,25 +556,21 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_2` AS SELECT func_sidef_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_sidef_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -651,34 +578,29 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -697,24 +619,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -722,37 +640,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -771,26 +681,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -798,19 +702,19 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. INSERT INTO t0 VALUES (@@hostname); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (@@hostname) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -818,37 +722,29 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -867,14 +763,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -882,25 +774,21 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_2` AS SELECT func_sidef_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_sidef_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -908,34 +796,29 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -954,24 +837,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -979,37 +858,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1028,26 +899,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1056,11 +921,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_1` AS SELECT * FROM data_table LIMIT 1 -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -1068,22 +933,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1098,12 +961,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1111,11 +972,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_2` AS SELECT * FROM view_retval_1 -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t2 SELECT * FROM view_retval_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -1124,10 +985,10 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1135,19 +996,19 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO t0 SELECT * FROM data_table LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -1157,37 +1018,29 @@ SELECT * FROM data_table LIMIT 1; 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1206,14 +1059,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1221,25 +1070,21 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_2` AS SELECT func_sidef_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_sidef_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1247,34 +1092,29 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1293,24 +1133,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1318,37 +1154,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1367,26 +1195,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1394,19 +1216,19 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT DELAYED INTO t0 VALUES (1), (2) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -1414,14 +1236,14 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t1 SELECT func_sidef_1(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; -* binlog_format = STATEMENT: expect warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1429,7 +1251,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1451,7 +1273,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1459,7 +1281,7 @@ DROP TRIGGER trig_2; Invoking view view_sidef_2 invoking function func_sidef_1 invoking unsafe update of two autoinc columns. CREATE VIEW view_sidef_2 AS SELECT func_sidef_1(); -* binlog_format = STATEMENT: expect warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT * FROM view_sidef_2; * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1467,7 +1289,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1476,7 +1298,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_1(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1493,7 +1315,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1501,7 +1323,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1520,7 +1342,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1528,7 +1350,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1547,14 +1369,14 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_1 VALUES (1); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. Invoking function func_sidef_2 invoking trigger trig_1 invoking unsafe update of two autoinc columns. CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; -* binlog_format = STATEMENT: expect warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO t2 SELECT func_sidef_2(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1562,7 +1384,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. CALL proc_2(); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1584,7 +1406,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO trigger_table_2 VALUES (1); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1592,7 +1414,7 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_2; * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1601,14 +1423,14 @@ 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 warning. +* binlog_format = STATEMENT: expect 0 warnings. EXECUTE prep_1; * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. DROP PREPARE prep_1; Invoking unsafe update of two autoinc columns. -* binlog_format = STATEMENT: expect warning. +* binlog_format = STATEMENT: expect 0 warnings. INSERT INTO double_autoinc_table VALUES (NULL); * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. @@ -1617,11 +1439,10 @@ INSERT INTO double_autoinc_table VALUES (NULL); 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -1629,12 +1450,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 VALUES (func_retval_2()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -1643,24 +1462,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1677,13 +1492,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1691,12 +1503,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_2` AS SELECT func_retval_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_retval_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -1705,11 +1516,10 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (func_retval_1()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1717,37 +1527,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1766,14 +1568,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1781,25 +1579,21 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_2` AS SELECT func_sidef_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_sidef_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1807,34 +1601,29 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1853,24 +1642,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1878,37 +1663,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1927,26 +1704,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -1955,32 +1726,30 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_1` AS SELECT myfunc_int(10) -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t1 SELECT * FROM view_sidef_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_sidef_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_sidef_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -1995,12 +1764,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_sidef_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2008,21 +1775,21 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_2` AS SELECT * FROM view_sidef_1 -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t2 SELECT * FROM view_sidef_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_sidef_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2030,19 +1797,19 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO t0 VALUES (myfunc_int(10)) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -2050,37 +1817,29 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -2099,14 +1858,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2114,25 +1869,21 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_sidef_2` AS SELECT func_sidef_1() -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT * FROM view_sidef_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT func_sidef_1() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2140,10 +1891,10 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -2157,23 +1908,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -2189,23 +1937,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -2221,37 +1966,29 @@ 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 warning. +* 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. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -2270,26 +2007,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO ta1 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_1 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2298,11 +2029,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_1` AS SELECT COUNT(*) FROM mysql.general_log -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -2310,22 +2041,20 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t2 SELECT func_sidef_2() +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. CALL proc_2(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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'. @@ -2340,12 +2069,10 @@ 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 warning. +* 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. Statement: INSERT INTO ta2 VALUES (47) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO trigger_table_2 VALUES (1) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2353,11 +2080,11 @@ 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. Statement: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_retval_2` AS SELECT * FROM view_retval_1 -* binlog_format = STATEMENT: expect warning. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t2 SELECT * FROM view_retval_2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. @@ -2366,10 +2093,10 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_2; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM view_retval_1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2377,29 +2104,691 @@ 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 warning. +* binlog_format = STATEMENT: expect 1 warnings. EXECUTE prep_1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 warning. +* 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. Statement: INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. * SQL_LOG_BIN = 0: expect nothing logged and no warning. * binlog_format = MIXED: expect row events in binlog and no warning. * Invoke statement so that return value is dicarded: expect no warning. SELECT COUNT(*) FROM mysql.general_log; + +==== Testing a statement that is unsafe in many ways ==== + +Invoking function func_sidef_1 invoking statement that is unsafe in many ways. +CREATE FUNCTION func_sidef_1() RETURNS VARCHAR(100) BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; RETURN 0; END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO t1 SELECT func_sidef_1(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. + +Invoking function func_sidef_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. +CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); RETURN 0; END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO t2 SELECT func_sidef_2(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP FUNCTION func_sidef_2; + +Invoking procedure proc_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. +CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; +* binlog_format = STATEMENT: expect 6 warnings. +CALL proc_2(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (test.ta1) +master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) +master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PROCEDURE proc_2; + +Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. +CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO trigger_table_2 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO t2 SELECT * FROM view_sidef_2; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP VIEW view_sidef_2; + +Invoking prepared statement prep_2 invoking function func_sidef_1 invoking statement that is unsafe in many ways. +PREPARE prep_2 FROM "INSERT INTO t1 SELECT func_sidef_1()"; +* binlog_format = STATEMENT: expect 6 warnings. +EXECUTE prep_2; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP PREPARE prep_2; +DROP FUNCTION func_sidef_1; + +Invoking procedure proc_1 invoking statement that is unsafe in many ways. +CREATE PROCEDURE proc_1() BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END; +* binlog_format = STATEMENT: expect 6 warnings. +CALL proc_1(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. + +Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. +CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO t2 SELECT func_sidef_2(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP FUNCTION func_sidef_2; + +Invoking procedure proc_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. +CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; +* binlog_format = STATEMENT: expect 6 warnings. +CALL proc_2(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.ta1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) +master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PROCEDURE proc_2; + +Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. +CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO trigger_table_2 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP TRIGGER trig_2; + +Invoking prepared statement prep_2 invoking procedure proc_1 invoking statement that is unsafe in many ways. +PREPARE prep_2 FROM "CALL proc_1()"; +* binlog_format = STATEMENT: expect 6 warnings. +EXECUTE prep_2; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP PREPARE prep_2; +DROP PROCEDURE proc_1; + +Invoking trigger trig_1 invoking statement that is unsafe in many ways. +CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO trigger_table_1 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. + +Invoking function func_sidef_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. +CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); RETURN 0; END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO t2 SELECT func_sidef_2(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP FUNCTION func_sidef_2; + +Invoking procedure proc_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. +CREATE PROCEDURE proc_2() BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; +* binlog_format = STATEMENT: expect 6 warnings. +CALL proc_2(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) +master-bin.000001 # Table_map # # table_id: # (test.ta1) +master-bin.000001 # Table_map # # table_id: # (test.double_autoinc_table) +master-bin.000001 # Table_map # # table_id: # (test.autoinc_table) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PROCEDURE proc_2; + +Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. +CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; +* binlog_format = STATEMENT: expect 6 warnings. +INSERT INTO trigger_table_2 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP TRIGGER trig_2; + +Invoking prepared statement prep_2 invoking trigger trig_1 invoking statement that is unsafe in many ways. +PREPARE prep_2 FROM "INSERT INTO trigger_table_1 VALUES (1)"; +* binlog_format = STATEMENT: expect 6 warnings. +EXECUTE prep_2; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP PREPARE prep_2; +DROP TRIGGER trig_1; + +Invoking prepared statement prep_1 invoking statement that is unsafe in many ways. +PREPARE prep_1 FROM "INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1"; +* binlog_format = STATEMENT: expect 6 warnings. +EXECUTE prep_1; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. +* SQL_LOG_BIN = 0: expect nothing logged and no warning. +* binlog_format = MIXED: expect row events in binlog and no warning. +DROP PREPARE prep_1; + +Invoking statement that is unsafe in many ways. +* binlog_format = STATEMENT: expect 6 warnings. +INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1; +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: 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: 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: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (test.ta0) +master-bin.000001 # Table_map # # table_id: # (test.ta1) +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PROCEDURE proc_2; + +Invoking trigger trig_2 invoking function func_sidef_1 invoking statement that is unsafe several times. +CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT func_sidef_1(); END; +* binlog_format = STATEMENT: expect 2 warnings. +INSERT INTO trigger_table_2 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.ta0) +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT + +Invoking function func_sidef_2 invoking procedure proc_1 invoking statement that is unsafe several times. +CREATE FUNCTION func_sidef_2() RETURNS VARCHAR(100) BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); RETURN 0; END; +* binlog_format = STATEMENT: expect 2 warnings. +INSERT INTO t2 SELECT func_sidef_2(); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.ta0) +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PROCEDURE proc_2; + +Invoking trigger trig_2 invoking procedure proc_1 invoking statement that is unsafe several times. +CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); CALL proc_1(); END; +* binlog_format = STATEMENT: expect 2 warnings. +INSERT INTO trigger_table_2 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta1 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.ta0) +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PREPARE prep_2; +DROP PROCEDURE proc_1; + +Invoking trigger trig_1 invoking statement that is unsafe several times. +CREATE TRIGGER trig_1 BEFORE INSERT ON trigger_table_1 FOR EACH ROW BEGIN INSERT INTO ta1 VALUES (47); INSERT INTO ta0 VALUES (multi_unsafe_func()); END; +* binlog_format = STATEMENT: expect 2 warnings. +INSERT INTO trigger_table_1 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.trigger_table_1) +master-bin.000001 # Table_map # # table_id: # (test.ta0) +master-bin.000001 # Table_map # # table_id: # (test.ta1) +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PROCEDURE proc_2; + +Invoking trigger trig_2 invoking trigger trig_1 invoking statement that is unsafe several times. +CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO trigger_table_1 VALUES (1); END; +* binlog_format = STATEMENT: expect 2 warnings. +INSERT INTO trigger_table_2 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO ta2 VALUES (47) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP PROCEDURE proc_2; + +Invoking trigger trig_2 invoking view view_sidef_1 invoking statement that is unsafe several times. +CREATE TRIGGER trig_2 BEFORE INSERT ON trigger_table_2 FOR EACH ROW BEGIN INSERT INTO ta2 VALUES (47); INSERT INTO t1 SELECT * FROM view_sidef_1; END; +* binlog_format = STATEMENT: expect 2 warnings. +INSERT INTO trigger_table_2 VALUES (1); +Warnings: +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system variable whose value may differ on slave. +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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, ta1, ta2, ta3, +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); @@ -2428,24 +2817,24 @@ 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. Statement: INSERT INTO t1 VALUES (@@session.sql_mode) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t1 VALUES (@@session.insert_id) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t1 SELECT * FROM t1 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: REPLACE INTO t1 SELECT * FROM t1 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: UPDATE t1 SET a=1 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: DELETE FROM t1 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2455,10 +2844,7 @@ DELETE FROM t1 LIMIT 1; END| CALL p1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM t1 LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: REPLACE INTO t1 SELECT * FROM t1 LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: UPDATE t1 SET a=1 LIMIT 1 -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: DELETE FROM t1 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; @@ -2466,7 +2852,7 @@ CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100)); INSERT INTO t1 VALUES ('a','b'); UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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); @@ -2475,7 +2861,7 @@ CREATE TABLE t3(i INT, ch CHAR(50)); "Should issue message Statement may not be safe to log in statement format." INSERT INTO t1 SELECT * FROM t2 LIMIT 1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 SELECT * FROM t2 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. CREATE FUNCTION func6() RETURNS INT BEGIN @@ -2487,10 +2873,7 @@ END| "Should issue message Statement may not be safe to log in statement format only once" INSERT INTO t3 VALUES(func6(), UUID()); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (10) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (11) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES (12) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t3 VALUES(func6(), UUID()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 @@ -2503,7 +2886,7 @@ SELECT fun_check_log_bin(); fun_check_log_bin() 100 Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t1 VALUES(@@global.sync_binlog) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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 @@ -2559,16 +2942,16 @@ 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. Statement: INSERT INTO t1 SELECT * FROM t2 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: INSERT INTO t1 VALUES(@@global.sync_binlog) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: UPDATE t1 SET i = 999 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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. Statement: DELETE FROM t1 LIMIT 1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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; diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index caf172e4a0e..8fb09fe9ab7 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -92,105 +92,149 @@ # related to logging format (not just 'Unsafe statement binlogged in # statement mode since BINLOG_FORMAT = STATEMENT'). -source include/have_udf.inc; -source include/have_log_bin.inc; -source include/have_binlog_format_statement.inc; +--source include/have_udf.inc +--source include/have_log_bin.inc +--source include/have_binlog_format_statement.inc --echo #### Setup tables #### -CREATE TABLE t0 (a CHAR(40)); -CREATE TABLE t1 (a CHAR(40)); -CREATE TABLE t2 (a CHAR(40)); -CREATE TABLE t3 (a CHAR(40)); -CREATE TABLE ta1 (a CHAR(40)); -CREATE TABLE ta2 (a CHAR(40)); -CREATE TABLE ta3 (a CHAR(40)); +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 double_autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT); ---DELIMITER | -CREATE TRIGGER double_autoinc_trig BEFORE INSERT ON double_autoinc_table FOR EACH ROW BEGIN - INSERT INTO autoinc_table VALUES (NULL); -END| ---DELIMITER ; -CREATE TABLE data_table (a CHAR(40)); +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); + +--DELIMITER | +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| +--DELIMITER ; + --replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB -eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB" # In each iteration of this loop, we select one method to make the # statement unsafe. -let $unsafe_type= 0; -while (`SELECT $unsafe_type < 7`) { +--let $unsafe_type= 0 +while (`SELECT $unsafe_type < 9`) { --echo if (`SELECT $unsafe_type = 0`) { --echo ==== Testing UUID() unsafeness ==== - let $desc_0= unsafe UUID() function; - let $stmt_sidef_0= INSERT INTO t0 VALUES (UUID()); - let $value_0= UUID(); - let $sel_sidef_0=; - let $sel_retval_0= SELECT UUID(); + --let $desc_0= unsafe UUID() function + --let $stmt_sidef_0= INSERT INTO t0 VALUES (UUID()) + --let $value_0= UUID() + --let $sel_sidef_0= + --let $sel_retval_0= SELECT UUID() + --let $CRC_ARG_expected_number_of_warnings= 1 } if (`SELECT $unsafe_type = 1`) { --echo ==== Testing @@hostname unsafeness ==== - let $desc_0= unsafe @@hostname variable; - let $stmt_sidef_0= INSERT INTO t0 VALUES (@@hostname); - let $value_0= @@hostname; - let $sel_sidef_0=; + --let $desc_0= unsafe @@hostname variable + --let $stmt_sidef_0= INSERT INTO t0 VALUES (@@hostname) + --let $value_0= @@hostname + --let $sel_sidef_0= # $sel_retval is going to be used in views. Views cannot execute # statements that refer to @@variables. Hence, we set $set_retval # to empty instead of SELECT @@hostname. - let $sel_retval_0=; + --let $sel_retval_0= + --let $CRC_ARG_expected_number_of_warnings= 1 } if (`SELECT $unsafe_type = 2`) { --echo ==== Testing SELECT...LIMIT unsafeness ==== - let $desc_0= unsafe SELECT...LIMIT statement; - let $stmt_sidef_0= INSERT INTO t0 SELECT * FROM data_table LIMIT 1; - let $value_0=; - let $sel_sidef_0=; - let $sel_retval_0= SELECT * FROM data_table LIMIT 1; + --let $desc_0= unsafe SELECT...LIMIT statement + --let $stmt_sidef_0= INSERT INTO t0 SELECT * FROM data_table LIMIT 1 + --let $value_0= + --let $sel_sidef_0= + --let $sel_retval_0= SELECT * FROM data_table LIMIT 1 + --let $CRC_ARG_expected_number_of_warnings= 1 } if (`SELECT $unsafe_type = 3`) { --echo ==== Testing INSERT DELAYED unsafeness ==== - let $desc_0= unsafe INSERT DELAYED statement; - let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2); - let $value_0=; - let $sel_sidef_0=; - let $sel_retval_0=; + --let $desc_0= unsafe INSERT DELAYED statement + --let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2) + --let $value_0= + --let $sel_sidef_0= + --let $sel_retval_0= + --let $CRC_ARG_expected_number_of_warnings= 1 } if (`SELECT $unsafe_type = 4`) { --echo ==== Testing unsafeness of insert of two autoinc values ==== - let $desc_0= unsafe update of two autoinc columns; - let $stmt_sidef_0= INSERT INTO double_autoinc_table VALUES (NULL); - let $value_0=; - let $sel_sidef_0=; - let $sel_retval_0=; + --let $desc_0= unsafe update of two autoinc columns + --let $stmt_sidef_0= INSERT INTO double_autoinc_table VALUES (NULL) + --let $value_0= + --let $sel_sidef_0= + --let $sel_retval_0= + # Note: we will expect 1 warning when BUG#45827 is fixed. + --let $CRC_ARG_expected_number_of_warnings= 0 } if (`SELECT $unsafe_type = 5`) { --echo ==== Testing unsafeness of UDF's ==== - let $desc_0= unsafe UDF; - let $stmt_sidef_0= INSERT INTO t0 VALUES (myfunc_int(10)); - let $value_0= myfunc_int(10); - let $sel_sidef_0= SELECT myfunc_int(10); - let $sel_retval_0= ; + --let $desc_0= unsafe UDF + --let $stmt_sidef_0= INSERT INTO t0 VALUES (myfunc_int(10)) + --let $value_0= myfunc_int(10) + --let $sel_sidef_0= SELECT myfunc_int(10) + --let $sel_retval_0= + --let $CRC_ARG_expected_number_of_warnings= 1 } if (`SELECT $unsafe_type = 6`) { --echo ==== Testing unsafeness of access to mysql.general_log ==== - let $desc_0= unsafe use of mysql.general_log; - let $stmt_sidef_0= INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log; - let $value_0=; - let $sel_sidef_0=; - let $sel_retval_0= SELECT COUNT(*) FROM mysql.general_log; + --let $desc_0= unsafe use of mysql.general_log + --let $stmt_sidef_0= INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log + --let $value_0= + --let $sel_sidef_0= + --let $sel_retval_0= SELECT COUNT(*) FROM mysql.general_log + --let $CRC_ARG_expected_number_of_warnings= 1 + } + + if (`SELECT $unsafe_type = 7`) { + --echo ==== Testing a statement that is unsafe in many ways ==== + --let $desc_0= statement that is unsafe in many ways + # Concatenate three unsafe values, and then concatenate NULL to + # that so that the result is NULL and we instead use autoinc. + --let $stmt_sidef_0= INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1 + --let $value_0= + --let $sel_sidef_0= + --let $sel_retval_0= + # Note: we will expect 7 warnings when BUG#45827 is fixed. + --let $CRC_ARG_expected_number_of_warnings= 6 + } + + if (`SELECT $unsafe_type = 8`) { + --echo ==== Testing a statement that is unsafe several times ==== + --let $desc_0= statement that is unsafe several times + --let $stmt_sidef_0= INSERT INTO ta0 VALUES (multi_unsafe_func()) + --let $value_0= + --let $sel_sidef_0= SELECT multi_unsafe_func() + --let $sel_retval_0= + --let $CRC_ARG_expected_number_of_warnings= 2 } # In each iteration of the following loop, we select one way to @@ -201,24 +245,24 @@ while (`SELECT $unsafe_type < 7`) { # In the last iteration, $call_type_1=7, we don't create a recursive # construct. Instead, we just invoke the unsafe statement directly. - let $call_type_1= 0; + --let $call_type_1= 0 while (`SELECT $call_type_1 < 8`) { #--echo debug: level 1, types $call_type_1 -> $unsafe_type - let $CRC_ARG_level= 1; - let $CRC_ARG_type= $call_type_1; - let $CRC_ARG_stmt_sidef= $stmt_sidef_0; - let $CRC_ARG_value= $value_0; - let $CRC_ARG_sel_sidef= $sel_sidef_0; - let $CRC_ARG_sel_retval= $sel_retval_0; - let $CRC_ARG_desc= $desc_0; - source extra/rpl_tests/create_recursive_construct.inc; - let $stmt_sidef_1= $CRC_RET_stmt_sidef; - let $value_1= $CRC_RET_value; - let $sel_sidef_1= $CRC_RET_sel_sidef; - let $sel_retval_1= $CRC_RET_sel_retval; - let $is_toplevel_1= $CRC_RET_is_toplevel; - let $drop_1= $CRC_RET_drop; - let $desc_1= $CRC_RET_desc; + --let $CRC_ARG_level= 1 + --let $CRC_ARG_type= $call_type_1 + --let $CRC_ARG_stmt_sidef= $stmt_sidef_0 + --let $CRC_ARG_value= $value_0 + --let $CRC_ARG_sel_sidef= $sel_sidef_0 + --let $CRC_ARG_sel_retval= $sel_retval_0 + --let $CRC_ARG_desc= $desc_0 + --source extra/rpl_tests/create_recursive_construct.inc + --let $stmt_sidef_1= $CRC_RET_stmt_sidef + --let $value_1= $CRC_RET_value + --let $sel_sidef_1= $CRC_RET_sel_sidef + --let $sel_retval_1= $CRC_RET_sel_retval + --let $is_toplevel_1= $CRC_RET_is_toplevel + --let $drop_1= $CRC_RET_drop + --let $desc_1= $CRC_RET_desc # Some statements must be top-level statements, i.e., cannot be # called as a sub-statement of any recursive construct. (One @@ -232,24 +276,24 @@ while (`SELECT $unsafe_type < 7`) { # the previous recursive construct in another recursive # construct. - let $call_type_2= 0; + --let $call_type_2= 0 while (`SELECT $call_type_2 < 7`) { #--echo debug: level 2, types $call_type_2 -> $call_type_1 -> $unsafe_type - let $CRC_ARG_level= 2; - let $CRC_ARG_type= $call_type_2; - let $CRC_ARG_stmt_sidef= $stmt_sidef_1; - let $CRC_ARG_value= $value_1; - let $CRC_ARG_sel_sidef= $sel_sidef_1; - let $CRC_ARG_sel_retval= $sel_retval_1; - let $CRC_ARG_desc= $desc_1; - source extra/rpl_tests/create_recursive_construct.inc; - let $stmt_sidef_2= $CRC_RET_stmt_sidef; - let $value_2= $CRC_RET_value; - let $sel_sidef_2= $CRC_RET_sel_sidef; - let $sel_retval_2= $CRC_RET_sel_retval; - let $is_toplevel_2= $CRC_RET_is_toplevel; - let $drop_2= $CRC_RET_drop; - let $desc_2= $CRC_RET_desc; + --let $CRC_ARG_level= 2 + --let $CRC_ARG_type= $call_type_2 + --let $CRC_ARG_stmt_sidef= $stmt_sidef_1 + --let $CRC_ARG_value= $value_1 + --let $CRC_ARG_sel_sidef= $sel_sidef_1 + --let $CRC_ARG_sel_retval= $sel_retval_1 + --let $CRC_ARG_desc= $desc_1 + --source extra/rpl_tests/create_recursive_construct.inc + --let $stmt_sidef_2= $CRC_RET_stmt_sidef + --let $value_2= $CRC_RET_value + --let $sel_sidef_2= $CRC_RET_sel_sidef + --let $sel_retval_2= $CRC_RET_sel_retval + --let $is_toplevel_2= $CRC_RET_is_toplevel + --let $drop_2= $CRC_RET_drop + --let $desc_2= $CRC_RET_desc if (!$is_toplevel_2) { @@ -261,51 +305,52 @@ while (`SELECT $unsafe_type < 7`) { # the previous recursive construct in another recursive # construct. - let $call_type_3= 0; + --let $call_type_3= 0 while (`SELECT $call_type_3 < 7`) { #--echo debug: level 3, types $call_type_2 -> $call_type_2 -> $call_type_1 -> $unsafe_type - let $CRC_ARG_level= 3; - let $CRC_ARG_type= $call_type_3; - let $CRC_ARG_stmt_sidef= $stmt_sidef_2; - let $CRC_ARG_value= $value_2; - let $CRC_ARG_sel_sidef= $sel_sidef_2; - let $CRC_ARG_sel_retval= $sel_retval_2; - let $CRC_ARG_desc= $desc_2; - source extra/rpl_tests/create_recursive_construct.inc; + --let $CRC_ARG_level= 3 + --let $CRC_ARG_type= $call_type_3 + --let $CRC_ARG_stmt_sidef= $stmt_sidef_2 + --let $CRC_ARG_value= $value_2 + --let $CRC_ARG_sel_sidef= $sel_sidef_2 + --let $CRC_ARG_sel_retval= $sel_retval_2 + --let $CRC_ARG_desc= $desc_2 + --source extra/rpl_tests/create_recursive_construct.inc # Drop created object. if (`SELECT '$drop_3' != ''`) { - eval $drop_3; + --eval $drop_3 } - inc $call_type_3; + --inc $call_type_3 } # while (call_type_3) } # if (0) } # if (!is_toplevel_2) # Drop created object. if (`SELECT '$drop_2' != ''`) { - eval $drop_2; + --eval $drop_2 } - inc $call_type_2; + --inc $call_type_2 } # while (call_type_2) } # if (!is_toplevel_1) # Drop created object. if (`SELECT '$drop_1' != ''`) { - eval $drop_1; + --eval $drop_1 } - inc $call_type_1; + --inc $call_type_1 } # while (call_type_1) - inc $unsafe_type; + --inc $unsafe_type } # while (unsafe_type) DROP TRIGGER double_autoinc_trig; -DROP TABLE t0, t1, t2, t3, ta1, ta2, ta3, +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; --echo ==== Special system variables that should *not* be unsafe ==== diff --git a/mysql-test/suite/rpl/r/rpl_stm_found_rows.result b/mysql-test/suite/rpl/r/rpl_stm_found_rows.result index 5252562acef..cff694318b3 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_found_rows.result +++ b/mysql-test/suite/rpl/r/rpl_stm_found_rows.result @@ -52,8 +52,8 @@ a a 7 Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO logtbl VALUES( NAME_CONST('sect',2), NAME_CONST('test',1), NAME_CONST('cnt',3)) -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO logtbl VALUES( NAME_CONST('sect',2), NAME_CONST('test',1)+1, NAME_CONST('cnt',183)) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: 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: Statement uses a system function whose value may differ on slave. CREATE PROCEDURE just_log(sect INT, test INT, found_rows INT) BEGIN INSERT INTO logtbl VALUES (sect,test,found_rows); END $$ diff --git a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result index a2fc22d9951..6a1475485f7 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result +++ b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result @@ -10,7 +10,7 @@ CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); INSERT INTO test.t1 VALUES(1,'test'); UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. create procedure test.p1() begin INSERT INTO test.t1 VALUES(2,'test'); @@ -18,8 +18,7 @@ UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; end| CALL test.p1(); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO test.t1 VALUES(2,'test') -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2 +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. SELECT * FROM test.t1 ORDER BY blob_column; a blob_column 1 abase diff --git a/mysql-test/suite/rpl/t/rpl_mix_found_rows.test b/mysql-test/suite/rpl/t/rpl_mix_found_rows.test index 30342126d24..9b8346ef21b 100644 --- a/mysql-test/suite/rpl/t/rpl_mix_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_mix_found_rows.test @@ -1,6 +1,14 @@ source include/master-slave.inc; source include/have_binlog_format_mixed.inc; +# It is not possible to replicate FOUND_ROWS() using statement-based +# replication, but there is a workaround that stores the result of +# FOUND_ROWS() into a user variable and then replicates this instead. +# +# The purpose of this test case is to test that the workaround works +# properly even when inside stored programs (i.e., stored routines and +# triggers). + --echo ==== Initialize ==== --echo **** On Master **** diff --git a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test index 940d9f73d13..9137dcfacd2 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test @@ -4,10 +4,10 @@ source include/master-slave.inc; # It is not possible to replicate FOUND_ROWS() using statement-based # replication, but there is a workaround that stores the result of # FOUND_ROWS() into a user variable and then replicates this instead. - -# The purpose of this test case is to test that the workaround -# function properly even when inside stored programs (i.e., stored -# routines and triggers). +# +# The purpose of this test case is to test that the workaround works +# properly even when inside stored programs (i.e., stored routines and +# triggers). --echo ==== Initialize ==== diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result index 3a31ecd77ba..fbb02b15d29 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result @@ -64,7 +64,7 @@ SET @@session.binlog_format = MIXED; * Unsafe statement and stmt-only engine INSERT INTO t_stmt VALUES (UUID()); Warnings: -Note 1639 Unsafe statement binlogged as statement since storage engine is limited to statement-logging. Statement: INSERT INTO t_stmt VALUES (UUID()) +Note 1639 Unsafe statement binlogged as statement since storage engine is limited to statement-logging. Reason: Statement uses a system function whose value may differ on slave. ---- binlog_format=statement ---- [on slave] include/stop_slave.inc @@ -93,7 +93,7 @@ ERROR HY000: Cannot execute row injection: binlogging impossible since BINLOG_FO * Unsafe statement and binlog_format=statement INSERT INTO t VALUES (UUID()); Warnings: -Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Statement: INSERT INTO t VALUES (UUID()) +Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason: Statement uses a system function whose value may differ on slave. ---- master: binlog_format=mixed, slave: binlog_format=statement ---- SET @@global.binlog_format = MIXED; SET @@session.binlog_format = MIXED; diff --git a/sql/item_create.cc b/sql/item_create.cc index 23a921be91c..c124128b3f8 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -2379,7 +2379,7 @@ Create_udf_func::create(THD *thd, udf_func *udf, List *item_list) if (item_list != NULL) arg_count= item_list->elements; - thd->lex->set_stmt_unsafe(); + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_UDF); DBUG_ASSERT( (udf->type == UDFTYPE_FUNCTION) || (udf->type == UDFTYPE_AGGREGATE)); @@ -3365,7 +3365,7 @@ Item* Create_func_found_rows::create(THD *thd) { DBUG_ENTER("Create_func_found_rows::create"); - thd->lex->set_stmt_unsafe(); + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION); thd->lex->safe_to_cache_query= 0; DBUG_RETURN(new (thd->mem_root) Item_func_found_rows()); } @@ -3794,7 +3794,7 @@ Item* Create_func_load_file::create(THD *thd, Item *arg1) { DBUG_ENTER("Create_func_load_file::create"); - thd->lex->set_stmt_unsafe(); + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); DBUG_RETURN(new (thd->mem_root) Item_load_file(arg1)); } @@ -4264,7 +4264,7 @@ Item* Create_func_row_count::create(THD *thd) { DBUG_ENTER("Create_func_row_count::create"); - thd->lex->set_stmt_unsafe(); + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION); thd->lex->safe_to_cache_query= 0; DBUG_RETURN(new (thd->mem_root) Item_func_row_count()); } @@ -4574,7 +4574,7 @@ Item* Create_func_uuid::create(THD *thd) { DBUG_ENTER("Create_func_uuid::create"); - thd->lex->set_stmt_unsafe(); + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION); thd->lex->safe_to_cache_query= 0; DBUG_RETURN(new (thd->mem_root) Item_func_uuid()); } @@ -4586,7 +4586,7 @@ Item* Create_func_uuid_short::create(THD *thd) { DBUG_ENTER("Create_func_uuid_short::create"); - thd->lex->set_stmt_unsafe(); + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION); thd->lex->safe_to_cache_query= 0; DBUG_RETURN(new (thd->mem_root) Item_func_uuid_short()); } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 629a24585b3..3d1782682c1 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -508,7 +508,7 @@ sp_head::operator delete(void *ptr, size_t size) throw() sp_head::sp_head() :Query_arena(&main_mem_root, INITIALIZED_FOR_SP), - m_flags(0), m_recursion_level(0), m_next_cached_sp(0), + m_flags(0), unsafe_flags(0), m_recursion_level(0), m_next_cached_sp(0), m_cont_level(0) { const LEX_STRING str_reset= { NULL, 0 }; @@ -2104,13 +2104,10 @@ sp_head::restore_lex(THD *thd) oldlex->trg_table_fields.push_back(&sublex->trg_table_fields); - /* - If this substatement needs row-based, the entire routine does too (we - cannot switch from statement-based to row-based only for this - substatement). - */ - if (sublex->is_stmt_unsafe()) - m_flags|= BINLOG_ROW_BASED_IF_MIXED; + /* If this substatement is unsafe, the entire routine is too. */ + DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags: 0x%x", + thd->lex->get_stmt_unsafe_flags())); + unsafe_flags|= sublex->get_stmt_unsafe_flags(); /* Add routines which are used by statement to respective set for diff --git a/sql/sp_head.h b/sql/sp_head.h index 7faccb7afbb..3de9abd6760 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -165,9 +165,8 @@ public: HAS_COMMIT_OR_ROLLBACK= 128, LOG_SLOW_STATEMENTS= 256, // Used by events LOG_GENERAL_LOG= 512, // Used by events - BINLOG_ROW_BASED_IF_MIXED= 1024, - HAS_SQLCOM_RESET= 2048, - HAS_SQLCOM_FLUSH= 4096 + HAS_SQLCOM_RESET= 1024, + HAS_SQLCOM_FLUSH= 2048 }; /** TYPE_ENUM_FUNCTION, TYPE_ENUM_PROCEDURE or TYPE_ENUM_TRIGGER */ @@ -198,6 +197,11 @@ public: private: Stored_program_creation_ctx *m_creation_ctx; + /** + Boolean combination of (1<set_stmt_unsafe(); + DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x", + lex->get_stmt_unsafe_flags())); + DBUG_PRINT("info", ("sp_head(0x%p=%s)->unsafe_flags: 0x%x", + this, name(), unsafe_flags)); + lex->set_stmt_unsafe_flags(unsafe_flags); DBUG_VOID_RETURN; } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 6359fb7b914..bec50443ee4 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -5152,12 +5152,17 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table) int THD::decide_logging_format(TABLE_LIST *tables) { DBUG_ENTER("THD::decide_logging_format"); + DBUG_PRINT("info", ("query: %s", query)); + DBUG_PRINT("info", ("variables.binlog_format: %ld", + variables.binlog_format)); + DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x", + lex->get_stmt_unsafe_flags())); if (mysql_bin_log.is_open() && (options & OPTION_BIN_LOG)) { /* - Compute the starting vectors for the computations by creating a - set with all the capabilities bits set and one with no - capabilities bits set. + Compute one bit field with the union of all the engine + capabilities, and one with the intersection of all the engine + capabilities. */ handler::Table_flags flags_some_set= 0; handler::Table_flags flags_all_set= @@ -5180,15 +5185,14 @@ int THD::decide_logging_format(TABLE_LIST *tables) /* Get the capabilities vector for all involved storage engines and - mask out the flags for the binary log. (Currently, the binlog - flags only include the capabilities of the storage engines.) + mask out the flags for the binary log. */ for (TABLE_LIST *table= tables; table; table= table->next_global) { if (table->placeholder()) continue; if (table->table->s->table_category == TABLE_CATEGORY_PERFORMANCE) - lex->set_stmt_unsafe(); + lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_TABLE); if (table->lock_type >= TL_WRITE_ALLOW_WRITE) { ulonglong const flags= table->table->file->ha_table_flags(); @@ -5210,12 +5214,11 @@ int THD::decide_logging_format(TABLE_LIST *tables) DBUG_PRINT("info", ("flags_some_set: %s%s", FLAGSTR(flags_some_set, HA_BINLOG_STMT_CAPABLE), FLAGSTR(flags_some_set, HA_BINLOG_ROW_CAPABLE))); - DBUG_PRINT("info", ("variables.binlog_format: %ld", - variables.binlog_format)); DBUG_PRINT("info", ("multi_engine: %s", multi_engine ? "TRUE" : "FALSE")); int error= 0; + int unsafe_flags; /* If more than one engine is involved in the statement and at @@ -5258,14 +5261,20 @@ int THD::decide_logging_format(TABLE_LIST *tables) */ my_error((error= ER_BINLOG_ROW_MODE_AND_STMT_ENGINE), MYF(0)); } - else if (lex->is_stmt_unsafe()) + else if ((unsafe_flags= lex->get_stmt_unsafe_flags()) != 0) { /* 3. Warning: Unsafe statement binlogged as statement since storage engine is limited to statement-logging. */ - binlog_warning_flags|= - (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_ENGINE); + binlog_unsafe_warning_flags|= + (1 << BINLOG_STMT_WARNING_UNSAFE_AND_STMT_ENGINE) | + (unsafe_flags << BINLOG_STMT_WARNING_COUNT); + DBUG_PRINT("info", ("Scheduling warning to be issued by " + "binlog_query: %s", + ER(ER_BINLOG_UNSAFE_AND_STMT_ENGINE))); + DBUG_PRINT("info", ("binlog_unsafe_warning_flags: 0x%x", + binlog_unsafe_warning_flags)); } /* log in statement format! */ } @@ -5291,14 +5300,20 @@ int THD::decide_logging_format(TABLE_LIST *tables) */ my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), ""); } - else if (lex->is_stmt_unsafe()) + else if ((unsafe_flags= lex->get_stmt_unsafe_flags()) != 0) { /* 7. Warning: Unsafe statement logged as statement due to binlog_format = STATEMENT */ - binlog_warning_flags|= - (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_MODE); + binlog_unsafe_warning_flags|= + (1 << BINLOG_STMT_WARNING_UNSAFE_AND_STMT_MODE) | + (unsafe_flags << BINLOG_STMT_WARNING_COUNT); + DBUG_PRINT("info", ("Scheduling warning to be issued by " + "binlog_query: '%s'", + ER(ER_BINLOG_UNSAFE_STATEMENT))); + DBUG_PRINT("info", ("binlog_stmt_flags: 0x%x", + binlog_unsafe_warning_flags)); } /* log in statement format! */ } @@ -5315,9 +5330,21 @@ int THD::decide_logging_format(TABLE_LIST *tables) } } - if (error) + if (error) { + DBUG_PRINT("info", ("decision: no logging since an error was generated")); DBUG_RETURN(-1); + } + DBUG_PRINT("info", ("decision: logging in %s format", + is_current_stmt_binlog_format_row() ? + "ROW" : "STATEMENT")); } +#ifndef DBUG_OFF + else + DBUG_PRINT("info", ("decision: no logging since " + "mysql_bin_log.is_open() = %d " + "and (options & OPTION_BIN_LOG) = 0x%llx", + mysql_bin_log.is_open(), (options & OPTION_BIN_LOG))); +#endif DBUG_RETURN(0); } @@ -5401,7 +5428,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen) if (thd->variables.binlog_format == BINLOG_FORMAT_MIXED && has_two_write_locked_tables_with_auto_increment(tables)) { - thd->lex->set_stmt_unsafe(); + thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_TWO_AUTOINC_COLUMNS); thd->set_current_stmt_binlog_row_based_if_mixed(); } } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index f401daaee9b..4f8f0a30544 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -39,6 +39,7 @@ #include #endif #include +#include #include "sp_rcontext.h" #include "sp_cache.h" @@ -540,7 +541,7 @@ THD::THD() lock_id(&main_lock_id), user_time(0), in_sub_stmt(0), sql_log_bin_toplevel(false), - binlog_warning_flags(0UL), binlog_table_maps(0), + binlog_unsafe_warning_flags(0), binlog_table_maps(0), table_map_for_update(0), arg_of_last_insert_id_function(FALSE), first_successful_insert_id_in_prev_stmt(0), @@ -3633,6 +3634,93 @@ show_query_type(THD::enum_binlog_query_type qtype) #endif +/** + Auxiliary method used by @c binlog_query() to raise warnings. + + @param err An ER_BINLOG_UNSAFE_* constant; the warning to print. +*/ +void THD::issue_unsafe_warnings() +{ + DBUG_ENTER("issue_unsafe_warnings"); + /* + Ensure that binlog_unsafe_warning_flags is big enough to hold all + bits. This is actually a constant expression. + */ + DBUG_ASSERT(BINLOG_STMT_WARNING_COUNT + 2 * LEX::BINLOG_STMT_UNSAFE_COUNT <= + sizeof(binlog_unsafe_warning_flags) * CHAR_BIT); + + /** + @note The order of the elements of this array must correspond to + the order of elements in enum_binlog_stmt_unsafe. + */ + static const char *explanations[LEX::BINLOG_STMT_UNSAFE_COUNT] = + { + "Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.", + "Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.", + "Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.", + "Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.", + "Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.", + "Statement uses a system variable whose value may differ on slave.", + "Statement uses a system function whose value may differ on slave." + }; + uint32 flags= binlog_unsafe_warning_flags; + /* No warnings (yet) for this statement. */ + if (flags == 0) + DBUG_VOID_RETURN; + + /* Get the types of unsafeness that affect the current statement. */ + uint32 unsafe_type_flags= flags >> BINLOG_STMT_WARNING_COUNT; + DBUG_ASSERT((unsafe_type_flags & LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS) != 0); + /* + Clear (1) bits above BINLOG_STMT_UNSAFE_COUNT; (2) bits for + warnings that have been printed already. + */ + unsafe_type_flags &= (LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS ^ + (unsafe_type_flags >> LEX::BINLOG_STMT_UNSAFE_COUNT)); + /* If all warnings have been printed already, return. */ + if (unsafe_type_flags == 0) + DBUG_VOID_RETURN; + + /* Figure out which error code to issue. */ + int err; + if (binlog_unsafe_warning_flags & + (1 << BINLOG_STMT_WARNING_UNSAFE_AND_STMT_ENGINE)) + err= ER_BINLOG_UNSAFE_AND_STMT_ENGINE; + else { + DBUG_ASSERT(binlog_unsafe_warning_flags & + (1 << BINLOG_STMT_WARNING_UNSAFE_AND_STMT_MODE)); + err= ER_BINLOG_UNSAFE_STATEMENT; + } + + DBUG_PRINT("info", ("flags: 0x%x err: %d", unsafe_type_flags, err)); + + /* + For each unsafe_type, check if the statement is unsafe in this way + and issue a warning. + */ + for (int unsafe_type=0; + unsafe_type < LEX::BINLOG_STMT_UNSAFE_COUNT; + unsafe_type++) + { + if ((unsafe_type_flags & (1 << unsafe_type)) != 0) + { + push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_NOTE, err, + "%s Reason: %s", + ER(err), explanations[unsafe_type]); + sql_print_warning("%s Reason: %s Statement: %s", + ER(err), explanations[unsafe_type], query); + } + } + /* + Mark these unsafe types as already printed, to avoid printing + warnings for them again. + */ + binlog_unsafe_warning_flags|= unsafe_type_flags << + (BINLOG_STMT_WARNING_COUNT + LEX::BINLOG_STMT_UNSAFE_COUNT); + DBUG_VOID_RETURN; +} + + /** Log the current query. @@ -3688,34 +3776,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, know for sure if the statement will be logged. */ if (sql_log_bin_toplevel) - { - if (binlog_warning_flags & - (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_ENGINE)) - { - push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_NOTE, - ER_BINLOG_UNSAFE_AND_STMT_ENGINE, - "%s Statement: %.*s", - ER(ER_BINLOG_UNSAFE_AND_STMT_ENGINE), - MYSQL_ERRMSG_SIZE, query_arg); - sql_print_warning("%s Statement: %.*s", - ER(ER_BINLOG_UNSAFE_AND_STMT_ENGINE), - MYSQL_ERRMSG_SIZE, query_arg); - binlog_warning_flags|= 1 << BINLOG_WARNING_FLAG_PRINTED; - } - else if (binlog_warning_flags & - (1 << BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_MODE)) - { - push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_NOTE, - ER_BINLOG_UNSAFE_STATEMENT, - "%s Statement: %.*s", - ER(ER_BINLOG_UNSAFE_STATEMENT), - MYSQL_ERRMSG_SIZE, query_arg); - sql_print_warning("%s Statement: %.*s", - ER(ER_BINLOG_UNSAFE_STATEMENT), - MYSQL_ERRMSG_SIZE, query_arg); - binlog_warning_flags|= 1 << BINLOG_WARNING_FLAG_PRINTED; - } - } + issue_unsafe_warnings(); switch (qtype) { /* @@ -3738,6 +3799,10 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, format; it cannot be logged in row format. This is typically used by DDL statements. It is an error to use this query type if current_stmt_binlog_row_based is set. + + @todo Currently there are places that call this method with + STMT_QUERY_TYPE and current_stmt_binlog_row_based. Fix those + places and add assert to ensure correct behavior. /Sven */ case THD::STMT_QUERY_TYPE: /* diff --git a/sql/sql_class.h b/sql/sql_class.h index 5e069f1cbb6..cf008cbf865 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1422,38 +1422,79 @@ public: int binlog_flush_pending_rows_event(bool stmt_end); int binlog_remove_pending_rows_event(bool clear_maps); - int is_current_stmt_binlog_format_row() { + /** + Determine the binlog format of the current statement. + + @retval 0 if the current statement will be logged in statement + format. + @retval nonzero if the current statement will be logged in row + format. + */ + int is_current_stmt_binlog_format_row() const { DBUG_ASSERT(current_stmt_binlog_format == BINLOG_FORMAT_STMT || current_stmt_binlog_format == BINLOG_FORMAT_ROW); return current_stmt_binlog_format == BINLOG_FORMAT_ROW; } private: - /* - Tells if current statement should binlog row-based(1) or stmt-based(0) + /** + Indicates the format in which the current statement will be + logged. This can only be set from @c decide_logging_format(). */ enum_binlog_format current_stmt_binlog_format; - enum enum_binlog_warning_flag { - /* ER_BINLOG_UNSAFE_AND_STMT_ENGINE affects current stmt */ - BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_ENGINE = 0, - /* ER_BINLOG_UNSAFE_AND_STMT_MODE affects current stmt */ - BINLOG_WARNING_FLAG_UNSAFE_AND_STMT_MODE, - /* One of the warnings has already been printed */ - BINLOG_WARNING_FLAG_PRINTED, - /* number of elements of this enum; insert new members above */ - BINLOG_WARNING_FLAG_COUNT - }; /** - Flags holding the status of binlog-related warnings for the - current statement. This is a binary combination of (1<lex object may change; e.g., if a + stored routine is invoked. Only THD persists between the calls. + */ + uint32 binlog_unsafe_warning_flags; + + void issue_unsafe_warnings(); /* Number of outstanding table maps, i.e., table maps in the @@ -2138,6 +2179,14 @@ public: inline void set_current_stmt_binlog_row_based_if_mixed() { DBUG_ENTER("set_current_stmt_binlog_row_based_if_mixed"); + /* + This should only be called from decide_logging_format. + + @todo Once we have ensured this, uncomment the following + statement, remove the big comment below that, and remove the + in_sub_stmt==0 condition from the following 'if'. + */ + /* DBUG_ASSERT(in_sub_stmt == 0); */ /* If in a stored/function trigger, the caller should already have done the change. We test in_sub_stmt to prevent introducing bugs where people @@ -2149,7 +2198,7 @@ public: */ if ((variables.binlog_format == BINLOG_FORMAT_MIXED) && (in_sub_stmt == 0)) - current_stmt_binlog_format= BINLOG_FORMAT_ROW; + set_current_stmt_binlog_row_based(); DBUG_VOID_RETURN; } @@ -2189,9 +2238,10 @@ public: show_system_thread(system_thread))); if ((temporary_tables == NULL) && (in_sub_stmt == 0)) { - current_stmt_binlog_format= - (variables.binlog_format == BINLOG_FORMAT_ROW) ? - BINLOG_FORMAT_ROW : BINLOG_FORMAT_STMT; + if (variables.binlog_format == BINLOG_FORMAT_ROW) + set_current_stmt_binlog_row_based(); + else + clear_current_stmt_binlog_row_based(); } DBUG_VOID_RETURN; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index e48731079eb..3cc4a6ea1a1 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1745,7 +1745,7 @@ public: decide_logging_format is made. We should probably call thd->decide_logging_format() directly instead. /Sven */ - thd.lex->set_stmt_unsafe(); + thd.lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); thd.set_current_stmt_binlog_row_based_if_mixed(); bzero((char*) &thd.net, sizeof(thd.net)); // Safety diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 9528d8f8f29..17ef4e7abd1 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1043,49 +1043,143 @@ public: } } - /** - Has the parser/scanner detected that this statement is unsafe? - @retval 0 if the statement is not marked as unsafe - @retval nonzero if the statement is marked as unsafe + /** + Enumeration listing of all types of unsafe statement. + + @note The order of elements of this enumeration type must + correspond to the order of the elements of the @c explanations + array defined in the body of @c THD::issue_unsafe_warnings. + */ + enum enum_binlog_stmt_unsafe { + /** + SELECT..LIMIT is unsafe because the set of rows returned cannot + be predicted. + */ + BINLOG_STMT_UNSAFE_LIMIT= 0, + /** + INSERT DELAYED is unsafe because the time when rows are inserted + cannot be predicted. + */ + BINLOG_STMT_UNSAFE_INSERT_DELAYED, + /** + Access to log tables is unsafe because slave and master probably + log different things. + */ + BINLOG_STMT_UNSAFE_SYSTEM_TABLE, + /** + Update of two autoincrement columns is unsafe. With one + autoincrement column, we store the counter in the binlog so that + slave can restore the correct value. But we can only store one + such counter per statement, so updating more than one + autoincrement column is not safe. + */ + BINLOG_STMT_UNSAFE_TWO_AUTOINC_COLUMNS, + /** + Using a UDF (user-defined function) is unsafe. + */ + BINLOG_STMT_UNSAFE_UDF, + /** + Using most system variables is unsafe, because slave may run + with different options than master. + */ + BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE, + /** + Using some functions is unsafe (e.g., UUID). + */ + BINLOG_STMT_UNSAFE_FUNCTION, + + /* The last element of this enumeration type. */ + BINLOG_STMT_UNSAFE_COUNT + }; + /** + This has all flags from 0 (inclusive) to BINLOG_STMT_FLAG_COUNT + (exclusive) set. + */ + static const int BINLOG_STMT_UNSAFE_ALL_FLAGS= + ((1 << BINLOG_STMT_UNSAFE_COUNT) - 1); + + /** + Determine if this statement is marked as unsafe. + + @retval 0 if the statement is not marked as unsafe. + @retval nonzero if the statement is marked as unsafe. */ inline bool is_stmt_unsafe() const { - return binlog_stmt_flags & (1U << BINLOG_STMT_FLAG_UNSAFE); + return get_stmt_unsafe_flags() != 0; } /** - Is this statement actually a row injection? + Flag the current (top-level) statement as unsafe. + The flag will be reset after the statement has finished. + + @param unsafe_type The type of unsafety: one of the @c + BINLOG_STMT_FLAG_UNSAFE_* flags in @c enum_binlog_stmt_flag. + */ + inline void set_stmt_unsafe(enum_binlog_stmt_unsafe unsafe_type) { + DBUG_ENTER("set_stmt_unsafe"); + DBUG_ASSERT(unsafe_type >= 0 && unsafe_type < BINLOG_STMT_UNSAFE_COUNT); + binlog_stmt_flags|= (1U << unsafe_type); + DBUG_VOID_RETURN; + } + + /** + Set the bits of binlog_stmt_flags determining the type of + unsafeness of the current statement. No existing bits will be + cleared, but new bits may be set. + + @param flags A binary combination of zero or more bits, (1<reset_for_next_command(); @@ -5674,7 +5673,7 @@ void THD::reset_for_next_command() thd->sent_row_count= thd->examined_row_count= 0; thd->reset_current_stmt_binlog_row_based(); - thd->binlog_warning_flags= 0; + thd->binlog_unsafe_warning_flags= 0; DBUG_PRINT("debug", ("current_stmt_binlog_row_based: %d", diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 2a4c5c950fe..c285e40a148 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1306,8 +1306,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, If the view's body needs row-based binlogging (e.g. the VIEW is created from SELECT UUID()), the top statement also needs it. */ - if (lex->is_stmt_unsafe()) - old_lex->set_stmt_unsafe(); + old_lex->set_stmt_unsafe_flags(lex->get_stmt_unsafe_flags()); + view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE && lex->can_be_merged()); LINT_INIT(view_main_select_tables); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c98fd93c1a7..bf8479894f6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7213,7 +7213,7 @@ function_call_keyword: $$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context()); if ($$ == NULL) MYSQL_YYABORT; - Lex->set_stmt_unsafe(); + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION); Lex->safe_to_cache_query= 0; } | DATE_SYM '(' expr ')' @@ -7368,7 +7368,7 @@ function_call_keyword: $$= new (YYTHD->mem_root) Item_func_user(); if ($$ == NULL) MYSQL_YYABORT; - Lex->set_stmt_unsafe(); + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION); Lex->safe_to_cache_query=0; } | YEAR_SYM '(' expr ')' @@ -8098,7 +8098,7 @@ variable_aux: if (!($$= get_system_var(YYTHD, $2, $3, $4))) MYSQL_YYABORT; if (!((Item_func_get_system_var*) $$)->is_written_to_binlog()) - Lex->set_stmt_unsafe(); + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE); } ; @@ -8944,7 +8944,10 @@ opt_limit_clause: ; limit_clause: - LIMIT limit_options { Lex->set_stmt_unsafe(); } + LIMIT limit_options + { + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + } ; limit_options: @@ -9006,7 +9009,7 @@ delete_limit_clause: { SELECT_LEX *sel= Select; sel->select_limit= $2; - Lex->set_stmt_unsafe(); + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); sel->explicit_limit= 1; } ; @@ -9463,7 +9466,7 @@ insert_lock_option: | DELAYED_SYM { $$= TL_WRITE_DELAYED; - Lex->set_stmt_unsafe(); + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); } | HIGH_PRIORITY { $$= TL_WRITE; } ; @@ -9473,7 +9476,7 @@ replace_lock_option: | DELAYED_SYM { $$= TL_WRITE_DELAYED; - Lex->set_stmt_unsafe(); + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_INSERT_DELAYED); } ; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 39e311fbd4b..c72d13df939 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6861,10 +6861,9 @@ ha_innobase::external_lock( if (lock_type == F_WRLCK && !(table_flags() & HA_BINLOG_STMT_CAPABLE) && thd_binlog_format(thd) == BINLOG_FORMAT_STMT) { - int skip = 0; - /* used by test case */ - DBUG_EXECUTE_IF("no_innodb_binlog_errors", skip = 1;); - if (!skip) { + /* The error may be suppressed by test cases, by setting + the no_innodb_binlog_errors debug symbol. */ + if (DBUG_EVALUATE_IF("no_innodb_binlog_errors", 0, 1)) { my_error(ER_BINLOG_STMT_MODE_AND_ROW_ENGINE, MYF(0), " InnoDB is limited to row-logging when " "transaction isolation level is "