1
###########################################################
3
###########################################################
4
# See if queries that use both auto_increment and LAST_INSERT_ID()
6
############################################################
8
# Auto increment should work for a table with auto_increment column
10
##############################################################
12
# We also check how the foreign_key_check variable is replicated
14
-- source include/master-slave.inc
15
#should work for both SBR and RBR
18
create table t1(a int auto_increment, primary key(a));
19
create table t2(b int auto_increment, c int, primary key(b));
20
insert into t1 values (1),(2),(3);
21
insert into t1 values (null);
22
insert into t2 values (null,last_insert_id());
26
select * from t1 ORDER BY a;
27
select * from t2 ORDER BY b;
29
#check if multi-line inserts,
30
#which set last_insert_id to the first id inserted,
31
#are replicated the same way
35
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
36
eval create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=$engine_type;
38
SET FOREIGN_KEY_CHECKS=0;
39
insert into t1 values (10);
40
insert into t1 values (null),(null),(null);
41
insert into t2 values (5,0);
42
insert into t2 values (null,last_insert_id());
43
SET FOREIGN_KEY_CHECKS=1;
51
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
55
create table t1(a int auto_increment, primary key(a));
56
create table t2(b int auto_increment, c int, primary key(b));
57
insert into t1 values (10);
58
insert into t1 values (null),(null),(null);
59
insert into t2 values (5,0);
60
insert into t2 (c) select * from t1 ORDER BY a;
61
select * from t2 ORDER BY b;
65
select * from t1 ORDER BY a;
66
select * from t2 ORDER BY b;
75
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
79
SET TIMESTAMP=1000000000;
80
CREATE TABLE t1 ( a INT UNIQUE );
81
SET FOREIGN_KEY_CHECKS=0;
82
# Duplicate Key Errors codes
84
INSERT INTO t1 VALUES (1),(1);
85
sync_slave_with_master;