mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
61 lines
2.2 KiB
Text
61 lines
2.2 KiB
Text
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
|
|
CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL auto_increment,
|
|
`b` int(11) default NULL,
|
|
PRIMARY KEY (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
|
CREATE TABLE `t2` (
|
|
`a` int(11) NOT NULL auto_increment,
|
|
`b` int(11) default NULL,
|
|
PRIMARY KEY (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
|
set @sav_binlog_format= @@session.binlog_format;
|
|
set @@session.binlog_format= mixed;
|
|
insert into t1 values (1,1),(2,2);
|
|
insert into t2 values (1,1),(4,4);
|
|
reset master;
|
|
UPDATE t2,t1 SET t2.a=t1.a+2;
|
|
ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
|
|
select * from t2 /* must be (3,1), (4,4) */;
|
|
a b
|
|
3 1
|
|
4 4
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000001 # Annotate_rows # # UPDATE t2,t1 SET t2.a=t1.a+2
|
|
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
|
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
|
|
master-bin.000001 # Query # # COMMIT
|
|
delete from t1;
|
|
delete from t2;
|
|
insert into t1 values (1,2),(3,4),(4,4);
|
|
insert into t2 values (1,2),(3,4),(4,4);
|
|
reset master;
|
|
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
|
|
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
|
master-bin.000001 # Annotate_rows # # UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a
|
|
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
|
master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F
|
|
master-bin.000001 # Query # # COMMIT
|
|
drop table t1, t2;
|
|
set @@session.binlog_format= @sav_binlog_format;
|
|
CREATE TABLE t1 (a int, PRIMARY KEY (a));
|
|
CREATE TABLE t2 (a int, PRIMARY KEY (a));
|
|
CREATE TABLE t3 (a int, PRIMARY KEY (a)) ENGINE=MyISAM;
|
|
create trigger trg_del_t3 before delete on t3 for each row insert into t1 values (1);
|
|
insert into t2 values (1),(2);
|
|
insert into t3 values (1),(2);
|
|
reset master;
|
|
delete t3.* from t2,t3 where t2.a=t3.a;
|
|
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
|
select count(*) from t1 /* must be 1 */;
|
|
count(*)
|
|
1
|
|
select count(*) from t3 /* must be 1 */;
|
|
count(*)
|
|
1
|
|
drop table t1, t2, t3;
|