| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); |
| 4 |
connection master; |
| 5 |
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam; |
| 6 |
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb; |
| 7 |
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key |
| 8 |
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb; |
| 9 |
set @@binlog_format=statement; |
| 10 |
*** autoincrement field is not the first in PK warning must be there: *** |
| 11 |
insert into tm set b=null, a=1; |
| 12 |
Warnings: |
| 13 |
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe |
| 14 |
show warnings; |
| 15 |
Level Code Message |
| 16 |
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe |
| 17 |
*** no warning when autoincrement is the first in PK |
| 18 |
insert into ti set b=null, a=1; |
| 19 |
show warnings; |
| 20 |
Level Code Message |
| 21 |
create function multi_part_pk_with_autoinc (arg int) |
| 22 |
returns int |
| 23 |
begin |
| 24 |
insert into tm set b=null, a=arg; |
| 25 |
return arg; |
| 26 |
end// |
| 27 |
select multi_part_pk_with_autoinc (3); |
| 28 |
multi_part_pk_with_autoinc (3) |
| 29 |
3 |
| 30 |
Warnings: |
| 31 |
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 |
| 32 |
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe |
| 33 |
*** autoincrement field is not the first in PK warning must be there: *** |
| 34 |
show warnings; |
| 35 |
Level Code Message |
| 36 |
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 |
| 37 |
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT into autoincrement field which is not the first part in the composed primary key is unsafe |
| 38 |
set @@binlog_format=mixed; |
| 39 |
insert into tm set b=null, a=2; |
| 40 |
connection slave; |
| 41 |
connection master; |
| 42 |
drop table tm, ti; |
| 43 |
drop function multi_part_pk_with_autoinc; |
| 44 |
connection slave; |
| 45 |
include/rpl_end.inc |