| 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 |
Warnings: |
| 35 |
Warning 1287 FOUND_ROWS() is deprecated and will be removed in a future release. Consider using COUNT(*) instead. |
| 36 |
INSERT INTO t1 VALUES (GET_LOCK('tmp', 1)); |
| 37 |
INSERT INTO t1 VALUES (IS_FREE_LOCK('tmp')); |
| 38 |
INSERT INTO t1 VALUES (IS_USED_LOCK('tmp')); |
| 39 |
INSERT INTO t1 VALUES (LOAD_FILE('../../std_data/words2.dat')); |
| 40 |
INSERT INTO t1 VALUES (SOURCE_POS_WAIT('dummy arg', 4711, 1)); |
| 41 |
INSERT INTO t1 VALUES (RELEASE_LOCK('tmp')); |
| 42 |
INSERT INTO t1 VALUES (ROW_COUNT()); |
| 43 |
INSERT INTO t1 VALUES (SESSION_USER()); |
| 44 |
INSERT INTO t1 VALUES (SLEEP(1)); |
| 45 |
INSERT INTO t1 VALUES (SYSDATE()); |
| 46 |
INSERT INTO t1 VALUES (SYSTEM_USER()); |
| 47 |
INSERT INTO t1 VALUES (USER()); |
| 48 |
INSERT INTO t1 VALUES (UUID()); |
| 49 |
INSERT INTO t1 VALUES (UUID_SHORT()); |
| 50 |
INSERT INTO t1 VALUES (VERSION()); |
| 51 |
INSERT INTO t1 VALUES (RAND()); |
| 52 |
DROP DATABASE b42851; |
| 53 |
USE test; |
| 54 |
# |
| 55 |
# Bug#46265: Can not disable warning about unsafe statements for binary logging |
| 56 |
# |
| 57 |
SET @old_log_error_verbosity = @@log_error_verbosity; |
| 58 |
DROP TABLE IF EXISTS t1; |
| 59 |
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(15)); |
| 60 |
SET GLOBAL log_error_verbosity = 1; |
| 61 |
INSERT INTO t1 VALUES(UUID(), 'timestamp'); |
| 62 |
Warnings: |
| 63 |
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 replica. |
| 64 |
SET GLOBAL log_error_verbosity = 2; |
| 65 |
INSERT INTO t1 VALUES(UUID(), 'timestamp'); |
| 66 |
Warnings: |
| 67 |
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 replica. |
| 68 |
DROP TABLE t1; |
| 69 |
SET GLOBAL log_error_verbosity = @old_log_error_verbosity; |
| 70 |
# Count the number of times the "Unsafe" message was printed |
| 71 |
# to the error log. |
| 72 |
Occurrences: 1 |
| 73 |
DROP TABLE IF EXISTS t1, t2; |
| 74 |
CREATE TABLE t1 (a int); |
| 75 |
CREATE TABLE t2 (a int auto_increment primary key, b int); |
| 76 |
CREATE TRIGGER tr_bug50192 AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (b) VALUES (1); |
| 77 |
CREATE FUNCTION sf_bug50192() RETURNS INTEGER |
| 78 |
BEGIN |
| 79 |
INSERT INTO t2(b) VALUES(2); |
| 80 |
RETURN 1; |
| 81 |
END | |
| 82 |
INSERT INTO t1 VALUES (0); |
| 83 |
Warnings: |
| 84 |
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. |
| 85 |
SHOW WARNINGS; |
| 86 |
Level Code Message |
| 87 |
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. |
| 88 |
SELECT sf_bug50192(); |
| 89 |
sf_bug50192() |
| 90 |
1 |
| 91 |
Warnings: |
| 92 |
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. |
| 93 |
SHOW WARNINGS; |
| 94 |
Level Code Message |
| 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 |
DROP FUNCTION sf_bug50192; |
| 97 |
DROP TRIGGER tr_bug50192; |
| 98 |
DROP TABLE t1, t2; |