~vkolesnikov/pbxt/pbxt-07-diskfull

« back to all changes in this revision

Viewing changes to pbxt/mysql-test-update/mysql-test/extra/rpl_tests/rpl_insert_id_pk.test

  • Committer: paul-mccullagh
  • Date: 2006-10-23 09:14:04 UTC
  • Revision ID: paul-mccullagh-918861e03d351978a9541168a96e58cc826734ee
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
###########################################################
 
2
# 2006-02-08: By JBM:  
 
3
###########################################################
 
4
# See if queries that use both auto_increment and LAST_INSERT_ID()
 
5
# are replicated well
 
6
############################################################
 
7
# REQUIREMENT
 
8
# Auto increment should work for a table with auto_increment column
 
9
# and primary key.
 
10
##############################################################
 
11
 
 
12
# We also check how the foreign_key_check variable is replicated
 
13
 
 
14
-- source include/master-slave.inc
 
15
#should work for both SBR and RBR
 
16
 
 
17
connection master;
 
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());
 
23
save_master_pos;
 
24
connection slave;
 
25
sync_with_master;
 
26
select * from t1 ORDER BY a;
 
27
select * from t2 ORDER BY b;
 
28
connection master;
 
29
#check if multi-line inserts,
 
30
#which set last_insert_id to the first id inserted,
 
31
#are replicated the same way
 
32
drop table t1;
 
33
drop table t2;
 
34
--disable_warnings
 
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;
 
37
--enable_warnings
 
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;
 
44
save_master_pos;
 
45
connection slave;
 
46
sync_with_master;
 
47
select * from t1;
 
48
select * from t2;
 
49
connection master;
 
50
 
 
51
# check if INSERT SELECT in auto_increment is well replicated (bug #490)
 
52
 
 
53
drop table t2;
 
54
drop table t1;
 
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;
 
62
save_master_pos;
 
63
connection slave;
 
64
sync_with_master;
 
65
select * from t1 ORDER BY a;
 
66
select * from t2 ORDER BY b;
 
67
connection master;
 
68
drop table t1;
 
69
drop table t2;
 
70
save_master_pos;
 
71
connection slave;
 
72
sync_with_master;
 
73
 
 
74
#
 
75
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
 
76
#           FOREIGN_KEY_CHECKS
 
77
#
 
78
connection master;
 
79
SET TIMESTAMP=1000000000;
 
80
CREATE TABLE t1 ( a INT UNIQUE );
 
81
SET FOREIGN_KEY_CHECKS=0;
 
82
# Duplicate Key Errors codes
 
83
--error 1022, 1062
 
84
INSERT INTO t1 VALUES (1),(1);
 
85
sync_slave_with_master;
 
86
connection master;
 
87
drop table t1;
 
88
# End of 4.1 tests