| 1 |
include/master-slave.inc |
| 2 |
Warnings: |
| 3 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 |
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 5 |
[connection master] |
| 6 |
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 7 |
# Create tables on master |
| 8 |
CREATE TABLE v1 (i VARCHAR(36) DEFAULT (RAND()), j VARCHAR(36) DEFAULT (PI())); |
| 9 |
# No warning expected as both columns are defined |
| 10 |
INSERT INTO v1(i, j) VALUES ("a","b"); |
| 11 |
# No warning expected as both columns are defined |
| 12 |
INSERT INTO v1 VALUES ("a","b"); |
| 13 |
# No warning expected as j is deterministic |
| 14 |
INSERT INTO v1(i) VALUES ("a"); |
| 15 |
# No warning expected as j is deterministic |
| 16 |
INSERT INTO v1(i,j) VALUES ("a",DEFAULT); |
| 17 |
# Warning expected as i is non-deterministic |
| 18 |
INSERT INTO v1(j) VALUES ("b"); |
| 19 |
Warnings: |
| 20 |
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. |
| 21 |
# Warning expected as i is non-deterministic |
| 22 |
INSERT INTO v1(i,j) VALUES (DEFAULT,"b"); |
| 23 |
Warnings: |
| 24 |
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. |
| 25 |
# Warning expected as i is non-deterministic |
| 26 |
INSERT INTO v1() VALUES(); |
| 27 |
Warnings: |
| 28 |
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. |
| 29 |
DROP TABLE v1; |
| 30 |
CREATE TABLE t1( |
| 31 |
id INTEGER NOT NULL AUTO_INCREMENT, |
| 32 |
token VARCHAR(255) DEFAULT (UUID()), |
| 33 |
PRIMARY KEY (id), |
| 34 |
KEY token (token) |
| 35 |
); |
| 36 |
# Warning expected as token is non-deterministic |
| 37 |
INSERT INTO t1 VALUES (3, "abc"), (DEFAULT, DEFAULT); |
| 38 |
Warnings: |
| 39 |
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. |
| 40 |
# No warning expected as token is defined |
| 41 |
INSERT INTO t1 VALUES (1, "abc"), (2, "def"); |
| 42 |
DROP TABLE t1; |
| 43 |
CREATE TABLE t2 (i VARCHAR(36) DEFAULT (UUID())); |
| 44 |
# Regular insert, no warnings |
| 45 |
INSERT INTO t2(i) VALUES('MySQL'); |
| 46 |
# Making sure that warnings are shown |
| 47 |
INSERT INTO t2(i) VALUES(DEFAULT); |
| 48 |
Warnings: |
| 49 |
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. |
| 50 |
INSERT INTO t2() VALUES(); |
| 51 |
Warnings: |
| 52 |
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. |
| 53 |
SELECT COUNT(*) from t2; |
| 54 |
COUNT(*) |
| 55 |
3 |
| 56 |
create table t1 ( i double DEFAULT ( RAND() ) ) ; |
| 57 |
insert into t1 values (1),(2) ; |
| 58 |
update t1 set i = DEFAULT where i = 2 ; |
| 59 |
Warnings: |
| 60 |
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. |
| 61 |
drop table t1; |
| 62 |
SET @start_enforce_gtid_consistency = @@GLOBAL.ENFORCE_GTID_CONSISTENCY; |
| 63 |
SET GLOBAL ENFORCE_GTID_CONSISTENCY = WARN; |
| 64 |
ALTER TABLE t2 ADD COLUMN c char(36) DEFAULT (PI()); |
| 65 |
SET GLOBAL ENFORCE_GTID_CONSISTENCY = @start_enforce_gtid_consistency; |
| 66 |
include/sync_slave_sql_with_master.inc |
| 67 |
[ slave connection ] |
| 68 |
SHOW TABLES; |
| 69 |
Tables_in_test |
| 70 |
t2 |
| 71 |
SHOW CREATE TABLE t2 ; |
| 72 |
Table Create Table |
| 73 |
t2 CREATE TABLE `t2` ( |
| 74 |
`i` varchar(36) DEFAULT (uuid()), |
| 75 |
`c` char(36) DEFAULT (pi()) |
| 76 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 77 |
SELECT COUNT(*) from t2; |
| 78 |
COUNT(*) |
| 79 |
3 |
| 80 |
# clean up |
| 81 |
[connection master] |
| 82 |
DROP TABLE t2; |
| 83 |
include/rpl_end.inc |