1
##################################################################
4
# This test is designed to test the changes included in WL#3228. #
5
# The changes include the ability to replicate with the master #
6
# having columns that are smaller (shorter) than the slave. #
7
##################################################################
9
-- source include/master-slave.inc
12
DROP TABLE IF EXISTS t1;
15
--echo **** Testing WL#3228 changes. ****
16
--echo *** Create "wider" table on slave ***
17
sync_slave_with_master;
21
eval CREATE TABLE t1 (
31
k enum ('5','6','7', '8','9','0'),
32
l set ('1','2','3','4','5','6','7','8','9','0','11','12','13','14','15','16','17','18','19','21','22','23','24','25','26','27','28','29'),
43
--echo *** Create same table on master but with narrow columns ***
45
eval CREATE TABLE t1 (
56
l set ('1','2','3','4','5','6','7','8','9','0'),
69
--echo *** Start replication ***
73
--echo *** Insert data on master and display it. ***
76
INSERT INTO t1 () VALUES (
97
# Replace values in columns that display differently between SBR & RBR
98
--replace_column 5 # 8 #
99
SELECT * FROM t1 ORDER BY a;
101
--echo *** Select data from slave to compare ***
102
sync_slave_with_master;
105
# Replace values in columns that display differently between SBR & RBR
106
--replace_column 5 # 8 #
107
SELECT * FROM t1 ORDER BY a;
109
# Test boundary limits of varchar and char fields
111
# <256/<256 with m < s, m > s, and m == s <-- col a
112
# >255/<256 with m < s, m > s, and m == s <-- error will be caught in BUG#22086
113
# <256/>255 with m < s, m > s, and m == s <-- col b
114
# >255/>255 with m < s, m > s, and m == s <-- col c
116
# Test boundary limits of CHAR fields
118
# <256/<256 with m < s, m > s, and m == s <-- col d
119
# >255/<256 with m < s, m > s, and m == s <-- error char limited to 255 chars
120
# <256/>255 with m < s, m > s, and m == s <-- error char limited to 255 chars
121
# >255/>255 with m < s, m > s, and m == s <-- error char limited to 255 chars
126
--echo Create varchar table on master
134
sync_slave_with_master slave;
136
--echo Alter varchar table on slave
137
ALTER TABLE t1 CHANGE COLUMN a a VARCHAR(100);
138
ALTER TABLE t1 CHANGE COLUMN b b VARCHAR(400);
139
ALTER TABLE t1 CHANGE COLUMN c c VARCHAR(500);
140
ALTER TABLE t1 CHANGE COLUMN d d CHAR(100);
144
--echo Insert some values and select them on master
145
INSERT INTO t1 VALUES ("This is a test of col a.",
146
"This is another test of col b.",
147
"This is a test of the large col c.",
150
--replace_result default DEFAULT
151
SHOW CREATE TABLE t1;
153
sync_slave_with_master slave;
155
--echo Insert some values and select them on slave
157
--replace_result default DEFAULT
158
SHOW CREATE TABLE t1;
161
# Test boundary limits of bit fields
162
# m < s, m % 8 != 0, and s % 8 == 0 col a
163
# m < s, m % 8 == 0, and s % 8 != 0 col b
164
# m < s, m % 8 != 0, and s % 8 != 0 col c
165
# m > s, m % 8 != 0, and s % 8 == 0 <-- error will be caught in BUG#22086
166
# m > s, m % 8 == 0, and s % 8 != 0 <-- error will be caught in BUG#22086
167
# m > s, m % 8 != 0, and s % 8 != 0 <-- error will be caught in BUG#22086
172
--echo Create bit table on master
181
sync_slave_with_master slave;
183
--echo Create bit table on slave
195
--echo Insert some values and select them on master
196
INSERT INTO t1 VALUES (
199
b'101010110101010101111',
204
SELECT BIN(a), BIN(b), BIN(c), BIN(d), BIN(e) FROM t1;
205
--replace_result default DEFAULT
206
SHOW CREATE TABLE t1;
208
sync_slave_with_master slave;
210
--echo Insert some values and select them on master
211
SELECT BIN(a), BIN(b), BIN(c), BIN(d), BIN(e) FROM t1;
212
--replace_result default DEFAULT
213
SHOW CREATE TABLE t1;
215
--echo *** Cleanup ***
218
sync_slave_with_master;