220
220
Warning 1592 Statement is not safe to log in statement format.
221
221
DROP PROCEDURE p1;
223
DROP TABLE IF EXISTS t1;
224
CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
225
INSERT INTO t1 VALUES ('a','b');
226
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
228
Warning 1592 Statement is not safe to log in statement format.
230
DROP TABLE IF EXISTS t1, t2;
231
CREATE TABLE t1(i INT PRIMARY KEY);
232
CREATE TABLE t2(i INT PRIMARY KEY);
233
CREATE TABLE t3(i INT, ch CHAR(50));
234
"Should issue message Statement is not safe to log in statement format."
235
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
237
Warning 1592 Statement is not safe to log in statement format.
238
CREATE FUNCTION func6()
241
INSERT INTO t1 VALUES (10);
242
INSERT INTO t1 VALUES (11);
243
INSERT INTO t1 VALUES (12);
246
"Should issue message Statement is not safe to log in statement format only once"
247
INSERT INTO t3 VALUES(func6(), UUID());
249
Warning 1592 Statement is not safe to log in statement format.
250
"Check whether SET @@SQL_LOG_BIN = 0/1 doesn't work in substatements"
251
CREATE FUNCTION fun_check_log_bin() RETURNS INT
253
SET @@SQL_LOG_BIN = 0;
254
INSERT INTO t1 VALUES(@@global.sync_binlog);
257
"One unsafe warning should be issued in the following statement"
258
SELECT fun_check_log_bin();
262
Warning 1592 Statement is not safe to log in statement format.
263
"SQL_LOG_BIN should be ON still"
264
SHOW VARIABLES LIKE "SQL_LOG_BIN";
267
set @save_log_bin = @@SESSION.SQL_LOG_BIN;
268
set @@SESSION.SQL_LOG_BIN = 0;
269
"Should NOT have any warning message issued in the following statements"
270
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
272
"Should NOT have any warning message issued in the following func7() and trig"
273
CREATE TABLE t1 (a INT);
274
CREATE TABLE t2 (a CHAR(40));
275
CREATE TABLE trigger_table (a CHAR(7));
276
CREATE FUNCTION func7()
279
INSERT INTO t1 VALUES (@@global.sync_binlog);
280
INSERT INTO t1 VALUES (@@session.insert_id);
281
INSERT INTO t2 SELECT UUID();
282
INSERT INTO t2 VALUES (@@session.sql_mode);
283
INSERT INTO t2 VALUES (@@global.init_slave);
286
SHOW VARIABLES LIKE "SQL_LOG_BIN";
292
---- Insert from trigger ----
294
BEFORE INSERT ON trigger_table
297
INSERT INTO t1 VALUES (@@global.sync_binlog);
298
INSERT INTO t1 VALUES (@@session.insert_id);
299
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
300
INSERT INTO t2 SELECT UUID();
301
INSERT INTO t2 VALUES (@@session.sql_mode);
302
INSERT INTO t2 VALUES (@@global.init_slave);
303
INSERT INTO t2 VALUES (@@hostname);
305
INSERT INTO trigger_table VALUES ('bye.');
306
DROP FUNCTION fun_check_log_bin;
310
DROP TABLE t1, t2, t3, trigger_table;
311
set @@SESSION.SQL_LOG_BIN = @save_log_bin;