Debian Codegraph @

mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result

raw
1 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
2 ### NOT filtered database => assertion: warnings ARE shown
3 DROP TABLE IF EXISTS t1;
4 CREATE TABLE t1 (a int, b int, primary key (a));
5 INSERT INTO t1 VALUES (1,2), (2,3);
6 UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
7 Warnings:
8 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted
9 UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
10 Warnings:
11 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. The statement is unsafe because it uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted
12 DROP TABLE t1;
13 ### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown
14 SET SQL_LOG_BIN= 0;
15 DROP TABLE IF EXISTS t1;
16 CREATE TABLE t1 (a int, b int, primary key (a));
17 INSERT INTO t1 VALUES (1,2), (2,3);
18 UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
19 UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
20 DROP TABLE t1;
21 SET SQL_LOG_BIN= 1;
22 ### FILTERED database => assertion: warnings ARE NOT shown
23 CREATE DATABASE b42851;
24 USE b42851;
25 DROP TABLE IF EXISTS t1;
26 CREATE TABLE t1 (a int, b int, primary key (a));
27 INSERT INTO t1 VALUES (1,2), (2,3);
28 UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
29 UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
30 DROP TABLE t1;
31 CREATE TABLE t1 (a VARCHAR(1000));
32 INSERT INTO t1 VALUES (CURRENT_USER());
33 INSERT INTO t1 VALUES (FOUND_ROWS());
34 INSERT INTO t1 VALUES (GET_LOCK('tmp', 1));
35 INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp'));
36 INSERT INTO t1 VALUES (IS_USED_LOCK('tmp'));
37 INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat'));
38 INSERT INTO t1 VALUES (MASTER_POS_WAIT('dummy arg', 4711, 1));
39 INSERT INTO t1 VALUES (RELEASE_LOCK('tmp'));
40 INSERT INTO t1 VALUES (ROW_COUNT());
41 INSERT INTO t1 VALUES (SESSION_USER());
42 INSERT INTO t1 VALUES (SLEEP(1));
43 INSERT INTO t1 VALUES (SYSDATE());
44 INSERT INTO t1 VALUES (SYSTEM_USER());
45 INSERT INTO t1 VALUES (USER());
46 INSERT INTO t1 VALUES (UUID());
47 INSERT INTO t1 VALUES (UUID_SHORT());
48 INSERT INTO t1 VALUES (VERSION());
49 INSERT INTO t1 VALUES (RAND());
50 DROP DATABASE b42851;
51 USE test;
52 #
53 # Bug#46265: Can not disable warning about unsafe statements for binary logging
54 #
55 SET @old_log_warnings = @@log_warnings;
56 DROP TABLE IF EXISTS t1;
57 CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(15));
58 SET GLOBAL LOG_WARNINGS = 0;
59 INSERT INTO t1 VALUES(UUID(), 'timestamp');
60 Warnings:
61 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
62 SET GLOBAL LOG_WARNINGS = 1;
63 INSERT INTO t1 VALUES(UUID(), 'timestamp');
64 Warnings:
65 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
66 DROP TABLE t1;
67 SET GLOBAL log_warnings = @old_log_warnings;
68 # Count the number of times the "Unsafe" message was printed
69 # to the error log.
70 Occurrences: 1
71 create table t1 (n1 int, n2 int, n3 int,
72 key (n1, n2, n3),
73 key (n2, n3, n1),
74 key (n3, n1, n2));
75 insert into t1 values (1,1,1);
76 insert into t1 values (RAND()*1000+10, RAND()*1000+10, RAND()*1000+10);
77 update t1 set n1=rand() where n1=1;
78 Warnings:
79 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
80 delete from t1 where n2=1 + rand()*0;
81 Warnings:
82 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
83 drop table t1;
84 DROP TABLE IF EXISTS t1, t2;
85 CREATE TABLE t1 (a int);
86 CREATE TABLE t2 (a int auto_increment primary key, b int);
87 CREATE TRIGGER tr_bug50192 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (b) VALUES (1);
88 CREATE FUNCTION sf_bug50192() RETURNS INTEGER
89 BEGIN
90 INSERT INTO t2(b) VALUES(2);
91 RETURN 1;
92 END |
93 INSERT INTO t1 VALUES (0);
94 Warnings:
95 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
96 SHOW WARNINGS;
97 Level Code Message
98 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
99 SELECT sf_bug50192();
100 sf_bug50192()
101 1
102 Warnings:
103 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
104 SHOW WARNINGS;
105 Level Code Message
106 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be logged correctly
107 CREATE TABLE t3 (a INT(11) DEFAULT NULL);
108 INSERT INTO t3 VALUES (1);
109 CREATE TABLE t4 (a INT(11) DEFAULT NULL, b BIGINT(20) DEFAULT uuid_short()) SELECT * FROM t3;
110 Warnings:
111 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
112 SHOW WARNINGS;
113 Level Code Message
114 Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave
115 CREATE OR REPLACE TABLE t4 (a INT(11) DEFAULT NULL) SELECT * FROM t3;
116 SHOW WARNINGS;
117 Level Code Message
118 DROP FUNCTION sf_bug50192;
119 DROP TRIGGER tr_bug50192;
120 DROP TABLE t1, t2, t3, t4;