mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / federated / federated.test
blob55a672587c8d2a5f429200dde1a34b7192bf185c
1 # Note: This test is tricky. It reuses the prerequisites generated for
2 #       replication tests (master+slave server and connections) for its
3 #       own purposes. But the replication feature itself is stopped.
7 # should work with embedded server after mysqltest is fixed
8 --source include/not_embedded.inc
9 --source suite/federated/include/federated.inc
11 connection default;
13 # Disable concurrent inserts to avoid test failures when reading
14 # data from concurrent connections (insert might return before
15 # the data is actually in the table).
16 SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
17 SET @@GLOBAL.CONCURRENT_INSERT= 0;
19 connection slave;
20 SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
21 SET @@GLOBAL.CONCURRENT_INSERT= 0;
22 DROP TABLE IF EXISTS federated.t1;
23 CREATE TABLE federated.t1 (
24     `id` int(20) NOT NULL,
25     `group` int NOT NULL default 0,
26     `a\\b` int NOT NULL default 0,
27     `a\\` int NOT NULL default 0,
28     `name` varchar(32) NOT NULL default ''
29     )
30   DEFAULT CHARSET=latin1;
32 connection master;
33 DROP TABLE IF EXISTS federated.t1;
34 # test too many items (malformed) in the comment string url
35 --error ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE
36 CREATE TABLE federated.t1 (
37     `id` int(20) NOT NULL,
38     `group` int NOT NULL default 0,
39     `a\\b` inT NOT NULL default 0,
40     `a\\` int NOT NULL default 0,
41     `name` varchar(32) NOT NULL default ''
42     )
43   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
44   CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1';
46 # test not enough items (malformed) in the comment string url
47 --error ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE 
48 CREATE TABLE federated.t1 (
49     `id` int(20) NOT NULL,
50     `group` int NOT NULL default 0,
51     `a\\b` iNt NOT NULL default 0,
52     `a\\` int NOT NULL default 0,
53     `name` varchar(32) NOT NULL default ''
54     )
55   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
56   CONNECTION='mysql://root@127.0.0.1';
58 # test non-existant table
59 --replace_result $SLAVE_MYPORT SLAVE_PORT
60 eval CREATE TABLE federated.t1 (
61     `id` int(20) NOT NULL,
62     `group` int NOT NULL default 0,
63     `a\\\\b` iNT NOT NULL default 0,
64     `a\\\\` int NOT NULL default 0,
65     `name` varchar(32) NOT NULL default ''
66     )
67   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
68   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3';
69 --error ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST
70 SELECT * FROM federated.t1;
71 DROP TABLE federated.t1;
73 # test bad user/password 
74 --replace_result $SLAVE_MYPORT SLAVE_PORT
75 eval CREATE TABLE federated.t1 (
76     `id` int(20) NOT NULL,
77     `group` int NOT NULL default 0,
78     `a\\\\b` Int NOT NULL default 0,
79     `a\\\\` int NOT NULL default 0,
80     `name` varchar(32) NOT NULL default ''
81     )
82   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
83   CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1';
84 --error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
85 SELECT * FROM federated.t1;
86 DROP TABLE federated.t1;
88 # # correct connection, same named tables
89 --replace_result $SLAVE_MYPORT SLAVE_PORT
90 eval CREATE TABLE federated.t1 (
91     `id` int(20) NOT NULL,
92     `group` int NOT NULL default 0,
93     `a\\\\b` InT NOT NULL default 0,
94     `a\\\\` int NOT NULL default 0,
95     `name` varchar(32) NOT NULL default ''
96     )
97   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
98   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
100 INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
101 INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
102 INSERT INTO federated.t1 (id, `group`) VALUES (3, 42);
103 INSERT INTO federated.t1 (id, `a\\b`) VALUES (4, 23);
104 INSERT INTO federated.t1 (id, `a\\`) VALUES (5, 1);
106 --sorted_result
107 SELECT * FROM federated.t1;
108 DELETE FROM federated.t1;
109 DROP TABLE federated.t1;
111 # correct connection, differently named tables
112 DROP TABLE IF EXISTS federated.t2;
113 --replace_result $SLAVE_MYPORT SLAVE_PORT
114 eval CREATE TABLE federated.t2 (
115     `id` int(20) NOT NULL,
116     `name` varchar(32) NOT NULL default ''
117     )
118   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
119   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
121 --replace_result $SLAVE_MYPORT SLAVE_PORT
122 eval SHOW CREATE TABLE federated.t2;
124 INSERT INTO federated.t2 (id, name) VALUES (1, 'foo');
125 INSERT INTO federated.t2 (id, name) VALUES (2, 'fee');
127 SELECT * FROM federated.t2 ORDER BY id, name;
128 DROP TABLE federated.t2;
130 connection slave;
131 DROP TABLE IF EXISTS federated.t1;
133 DROP TABLE IF EXISTS federated.`t1%`;
134 CREATE TABLE federated.`t1%` (
135     `id` int(20) NOT NULL,
136     `name` varchar(32) NOT NULL default ''
137     )
138   DEFAULT CHARSET=latin1;
140 connection master; 
141 DROP TABLE IF EXISTS federated.t1;
143 --replace_result $SLAVE_MYPORT SLAVE_PORT
144 eval CREATE TABLE federated.t1 (
145     `id` int(20) NOT NULL,
146     `name` varchar(32) NOT NULL default ''
147     )
148   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
149   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
151 INSERT INTO federated.t1 (id, name) VALUES (1, 'foo');
152 INSERT INTO federated.t1 (id, name) VALUES (2, 'fee');
154 SELECT * FROM federated.t1 ORDER BY id,name;
155 DELETE FROM federated.t1;
156 DROP TABLE IF EXISTS federated.t1;
158 --replace_result $SLAVE_MYPORT SLAVE_PORT
159 eval CREATE TABLE federated.`t1%` (
160     `id` int(20) NOT NULL,
161     `name` varchar(32) NOT NULL default ''
162     )
163   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
164   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%';
166 INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo');
167 INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee');
169 SELECT * FROM federated.`t1%` ORDER BY id, name;
170 DELETE FROM federated.`t1%`;
171 DROP TABLE IF EXISTS federated.`t1%`;
173 connection slave;
174 DROP TABLE IF EXISTS federated.`t1%`;
176 # I wanted to use timestamp, but results will fail if so!!!
177 DROP TABLE IF EXISTS federated.t1;
178 CREATE TABLE federated.t1 (
179     `id` int(20) NOT NULL auto_increment,
180     `name` varchar(32) NOT NULL default '',
181     `other` int(20) NOT NULL default '0',
182     `created` datetime default '2004-04-04 04:04:04',
183     PRIMARY KEY  (`id`))
184   DEFAULT CHARSET=latin1;
186 connection master;
187 --replace_result $SLAVE_MYPORT SLAVE_PORT
188 eval CREATE TABLE federated.t1 (
189     `id` int(20) NOT NULL auto_increment,
190     `name` varchar(32) NOT NULL default '',
191     `other` int(20) NOT NULL default '0',
192     `created` datetime default '2004-04-04 04:04:04',
193     PRIMARY KEY  (`id`))
194   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
195   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
197 INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
198 INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222);
199 INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333);
200 INSERT INTO federated.t1 (name, other) VALUES ('Fourth Name', 44444);
201 INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555);
202 INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666);
203 INSERT INTO federated.t1 (name, other) VALUES ('Seventh Name', 77777);
204 INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888);
205 INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999);
206 INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010);
208 # basic select
209 --sorted_result
210 SELECT * FROM federated.t1;
211 # with PRIMARY KEY index_read_idx
212 SELECT * FROM federated.t1 WHERE id = 5;
213 SELECT * FROM federated.t1 WHERE name = 'Sixth Name';
214 SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name';
215 SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444;
216 --sorted_result
217 SELECT * FROM federated.t1 WHERE name like '%th%';
218 UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
219 SELECT * FROM federated.t1 WHERE name = '3rd name';
220 UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name';
221 SELECT * FROM federated.t1 WHERE name = 'Third name';
222 # rnd_post, ::position
223 SELECT * FROM federated.t1 ORDER BY id DESC;
224 SELECT * FROM federated.t1 ORDER BY name;
225 SELECT * FROM federated.t1 ORDER BY name DESC;
226 SELECT * FROM federated.t1 ORDER BY name ASC;
227 SELECT * FROM federated.t1 GROUP BY other;
229 # ::delete_row
230 DELETE FROM federated.t1 WHERE id = 5; 
231 SELECT * FROM federated.t1 WHERE id = 5;
233 # ::delete_all_rows
234 DELETE FROM federated.t1;
235 SELECT * FROM federated.t1 WHERE id = 5;
237 # previous test, but this time with indexes
238 connection slave;
239 DROP TABLE IF EXISTS federated.t1;
240 CREATE TABLE federated.t1 (
241     `id` int(20) NOT NULL auto_increment,
242     `name` varchar(32) NOT NULL default '',
243     `other` int(20) NOT NULL default '0',
244     `created` datetime NOT NULL,
245     PRIMARY KEY  (`id`),
246     key name(`name`),
247     key other(`other`),
248     key created(`created`))
249   DEFAULT CHARSET=latin1;
251 connection master;
252 DROP TABLE IF EXISTS federated.t1;
253 --replace_result $SLAVE_MYPORT SLAVE_PORT
254 eval CREATE TABLE federated.t1 (
255     `id` int(20) NOT NULL auto_increment,
256     `name` varchar(32) NOT NULL default '',
257     `other` int(20) NOT NULL default '0',
258     `created` datetime NOT NULL,
259     PRIMARY KEY  (`id`),
260     key name(`name`),
261     key other(`other`),
262     key created(`created`))
263   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
264   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
266 INSERT INTO federated.t1 (name, other, created)
267   VALUES ('First Name', 11111, '2004-01-01 01:01:01');
268 INSERT INTO federated.t1 (name, other, created)
269   VALUES ('Second Name', 22222, '2004-01-23 02:43:00');
270 INSERT INTO federated.t1 (name, other, created)
271   VALUES ('Third Name', 33333, '2004-02-14 02:14:00');
272 INSERT INTO federated.t1 (name, other, created)
273   VALUES ('Fourth Name', 44444, '2003-04-05 00:00:00');
274 INSERT INTO federated.t1 (name, other, created) 
275   VALUES ('Fifth Name', 55555, '2001-02-02 02:02:02');
276 INSERT INTO federated.t1 (name, other, created) 
277   VALUES ('Sixth Name', 66666, '2005-06-06 15:30:00');
278 INSERT INTO federated.t1 (name, other, created) 
279   VALUES ('Seventh Name', 77777, '2003-12-12 18:32:00');
280 INSERT INTO federated.t1 (name, other, created) 
281   VALUES ('Eigth Name', 88888, '2005-03-12 11:00:00');
282 INSERT INTO federated.t1 (name, other, created) 
283   VALUES ('Ninth Name', 99999, '2005-03-12 11:00:01');
284 INSERT INTO federated.t1 (name, other, created) 
285   VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01');
287 # basic select
288 --sorted_result
289 SELECT * FROM federated.t1;
290 # with PRIMARY KEY index_read_idx
291 SELECT * FROM federated.t1 WHERE id = 5;
292 # with regular key index_read -> index_read_idx
293 # regular and PRIMARY KEY index_read_idx
294 SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name';
295 # with regular key index_read -> index_read_idx
296 SELECT * FROM federated.t1 WHERE other = 44444;
297 --sorted_result
298 SELECT * FROM federated.t1 WHERE name like '%th%';
299 # update - update_row, index_read_idx
300 UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
301 SELECT * FROM federated.t1 WHERE name = '3rd name';
302 # update - update_row, index_read -> index_read_idx
303 UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name';
304 SELECT * FROM federated.t1 WHERE name = 'Third name';
305 # rnd_post, ::position
306 SELECT * FROM federated.t1 ORDER BY id DESC;
307 SELECT * FROM federated.t1 ORDER BY name;
308 SELECT * FROM federated.t1 ORDER BY name DESC;
309 SELECT * FROM federated.t1 ORDER BY name ASC;
310 SELECT * FROM federated.t1 GROUP BY other;
312 # ::delete_row
313 DELETE FROM federated.t1 WHERE id = 5; 
314 SELECT * FROM federated.t1 WHERE id = 5;
316 # ::delete_all_rows
317 DELETE FROM federated.t1;
318 SELECT * FROM federated.t1 WHERE id = 5;
319 connection slave;
320 DROP TABLE IF EXISTS federated.t1;
321 CREATE TABLE federated.t1 ( 
322     `id` int(20) NOT NULL auto_increment,
323     `name` varchar(32),
324     `other` varchar(20),
325     PRIMARY KEY  (`id`) );
327 connection master;
328 DROP TABLE IF EXISTS federated.t1;
329 --replace_result $SLAVE_MYPORT SLAVE_PORT
330 eval CREATE TABLE federated.t1 (
331     `id` int(20) NOT NULL auto_increment,
332     `name` varchar(32), 
333     `other` varchar(20),
334     PRIMARY KEY  (`id`) )
335   ENGINE="FEDERATED"
336   DEFAULT CHARSET=latin1
337   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
339 INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111);
340 INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL);
341 INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333);
342 INSERT INTO federated.t1 (name, other) VALUES (NULL, NULL);
343 INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555);
344 INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666);
345 INSERT INTO federated.t1 (name) VALUES ('Seventh Name');
346 INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888);
347 INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999);
348 INSERT INTO federated.t1 (other) VALUES ('fee fie foe fum');
350 --sorted_result
351 SELECT * FROM federated.t1 WHERE other IS NULL;
352 --sorted_result
353 SELECT * FROM federated.t1 WHERE name IS NULL;
354 SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL;
355 --sorted_result
356 SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL;
358 UPDATE federated.t1
359 SET name = 'Fourth Name', other = 'four four four'
360 WHERE name IS NULL AND other IS NULL;
362 UPDATE federated.t1 SET other = 'two two two two' WHERE name = 'Second Name';
363 UPDATE federated.t1 SET other = 'seven seven' WHERE name like 'Sev%';
364 UPDATE federated.t1 SET name = 'Tenth Name' WHERE other like 'fee fie%';
365 SELECT * FROM federated.t1 WHERE name IS NULL OR other IS NULL ;
366 --sorted_result
367 SELECT * FROM federated.t1;
369 # test multi-keys
370 connection slave;
371 DROP TABLE IF EXISTS federated.t1;
372 CREATE TABLE federated.t1 (
373     `id` int(20) NOT NULL auto_increment,
374     `name` varchar(32) NOT NULL DEFAULT '',
375     `other` varchar(20) NOT NULL DEFAULT '',
376     PRIMARY KEY  (`id`),
377     KEY nameoth (name, other) );
379 connection master;
380 DROP TABLE IF EXISTS federated.t1;
381 --replace_result $SLAVE_MYPORT SLAVE_PORT
382 eval CREATE TABLE federated.t1 (
383     `id` int(20) NOT NULL auto_increment,
384     `name` varchar(32) NOT NULL DEFAULT '',
385     `other` varchar(20) NOT NULL DEFAULT '',
386     PRIMARY KEY  (`id`),
387     KEY nameoth (name, other))
388   ENGINE="FEDERATED" DEFAULT
389   CHARSET=latin1
390   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
392 INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111');
393 INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222');
394 INSERT INTO federated.t1 (name, other) VALUES ('Third Name', '3333');
395 SELECT * FROM federated.t1 WHERE name = 'Second Name';
396 SELECT * FROM federated.t1 WHERE other = '2222';
397 SELECT * FROM federated.t1 WHERE name = 'Third Name';
398 SELECT * FROM federated.t1 WHERE name = 'Third Name' AND other = '3333';
400 connection slave;
401 DROP TABLE IF EXISTS federated.t1;
402 CREATE TABLE federated.t1 (
403     `id` int NOT NULL auto_increment,
404     `name` char(32) NOT NULL DEFAULT '',
405     `bincol` binary(1) NOT NULL,
406     `floatval` decimal(5,2) NOT NULL DEFAULT 0.0,
407     `other` int NOT NULL DEFAULT 0,
408     PRIMARY KEY (id),
409     KEY nameoth(name, other),
410     KEY bincol(bincol),
411     KEY floatval(floatval));
413 # test other types of indexes
414 connection master;
415 DROP TABLE IF EXISTS federated.t1;
416 --replace_result $SLAVE_MYPORT SLAVE_PORT
417 eval CREATE TABLE federated.t1 (
418     `id` int NOT NULL auto_increment,
419     `name` char(32) NOT NULL DEFAULT '',
420     `bincol` binary(1) NOT NULL,
421     `floatval` decimal(5,2) NOT NULL DEFAULT 0.0,
422     `other` int NOT NULL DEFAULT 0,
423     PRIMARY KEY (id),
424     KEY nameoth(name,other),
425     KEY bincol(bincol),
426     KEY floatval(floatval))
427   ENGINE="FEDERATED"
428   DEFAULT CHARSET=latin1
429   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
431 INSERT INTO federated.t1 (name, bincol, floatval, other) 
432   VALUES ('first', 0x65, 11.11, 1111);
433 INSERT INTO federated.t1 (name, bincol, floatval, other)
434   VALUES ('second', 0x66, 22.22, 2222);
435 INSERT INTO federated.t1 (name, bincol, floatval, other)
436   VALUES ('third', 'g', 22.22, 2222);
437 --sorted_result
438 SELECT * FROM federated.t1;
439 SELECT * FROM federated.t1 WHERE name = 'second';
440 SELECT * FROM federated.t1 WHERE bincol= 'f';
441 SELECT * FROM federated.t1 WHERE bincol= 0x66;
442 SELECT * FROM federated.t1 WHERE bincol= 0x67;
443 SELECT * FROM federated.t1 WHERE bincol= 'g';
444 SELECT * FROM federated.t1 WHERE floatval=11.11;
445 SELECT * FROM federated.t1 WHERE name='third';
446 --sorted_result
447 SELECT * FROM federated.t1 WHERE other=2222;
448 SELECT * FROM federated.t1 WHERE name='third' and other=2222;
450 # more multi-column indexes, in the primary key
451 connection slave;
452 DROP TABLE IF EXISTS federated.t1;
453 CREATE TABLE federated.t1 (
454   `id` int NOT NULL auto_increment,
455   `col1` int(10) NOT NULL DEFAULT 0,
456   `col2` varchar(64) NOT NULL DEFAULT '',
457   `col3` int(20) NOT NULL,
458   `col4` int(40) NOT NULL,
459   primary key (`id`, `col1`, `col2`, `col3`, `col4`),
460   key col1(col1),
461   key col2(col2),
462   key col3(col3),
463   key col4(col4));
465 connection master;
466 DROP TABLE IF EXISTS federated.t1;
467 --replace_result $SLAVE_MYPORT SLAVE_PORT
468 eval CREATE TABLE federated.t1 (
469   `id` int NOT NULL auto_increment,
470   `col1` int(10) NOT NULL DEFAULT 0,
471   `col2` varchar(64) NOT NULL DEFAULT '',
472   `col3` int(20) NOT NULL,
473   `col4` int(40) NOT NULL,
474   primary key (`id`, `col1`, `col2`, `col3`, `col4`),
475   key col1(col1),
476   key col2(col2),
477   key col3(col3),
478   key col4(col4))
479   ENGINE="FEDERATED"
480   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
482 INSERT INTO federated.t1 (col1, col2, col3, col4) 
483   VALUES (1, 'one One', 11, 1111);
484 INSERT INTO federated.t1 (col1, col2, col3, col4) 
485   VALUES (2, 'Two two', 22, 2222);
486 INSERT INTO federated.t1 (col1, col2, col3, col4) 
487   VALUES (3, 'three Three', 33, 33333);
488 INSERT INTO federated.t1 (col1, col2, col3, col4) 
489   VALUES (4, 'fourfourfour', 444, 4444444);
490 INSERT INTO federated.t1 (col1, col2, col3, col4) 
491   VALUES (5, 'five 5 five five 5', 5, 55555);
492 INSERT INTO federated.t1 (col1, col2, col3, col4) 
493   VALUES (6, 'six six Sixsix', 6666, 6);
494 INSERT INTO federated.t1 (col1, col2, col3, col4) 
495   VALUES (7, 'seven Sevenseven', 77777, 7777);
496 INSERT INTO federated.t1 (col1, col2, col3, col4) 
497   VALUES (8, 'eight eight eight', 88888, 88);
498 INSERT INTO federated.t1 (col1, col2, col3, col4) 
499   VALUES (9, 'nine Nine', 999999, 999999);
500 INSERT INTO federated.t1 (col1, col2, col3, col4) 
501   VALUES (10, 'Tenth ten TEN', 1010101, 1010);
503 SELECT * FROM federated.t1 WHERE col2 = 'two two'; 
504 SELECT * FROM federated.t1 WHERE col2 = 'two Two'; 
505 SELECT * FROM federated.t1 WHERE id = 3; 
506 SELECT * FROM federated.t1 WHERE id = 3 AND col1 = 3; 
507 SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'Two two'; 
508 SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'fourfourfour'; 
509 SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' 
510   AND col3 = 5; 
511 SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' 
512   AND col3 = 5
513   AND col4 = 55555;
514 SELECT * FROM federated.t1 WHERE id = 5 
515   AND col2 = 'Two two' AND col3 = 22
516   AND col4 = 33;
517 SELECT * FROM federated.t1 WHERE id = 5 
518   AND col2 = 'five 5 five five 5' AND col3 = 5 
519   AND col4 = 55555;
520 --sorted_result
521 SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5')
522   OR (col2 = 'three Three' AND col3 = 33);
523 SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two')
524   OR (col2 = 444 AND col3 = 4444444);
525 --sorted_result
526 SELECT * FROM federated.t1 WHERE id = 1 
527   OR col1 = 10
528   OR col2 = 'Two two' 
529   OR col3 = 33
530   OR col4 = 4444444;
531 --sorted_result
532 SELECT * FROM federated.t1 WHERE id > 5; 
533 --sorted_result
534 SELECT * FROM federated.t1 WHERE id >= 5; 
535 --sorted_result
536 SELECT * FROM federated.t1 WHERE id < 5; 
537 --sorted_result
538 SELECT * FROM federated.t1 WHERE id <= 5; 
539 --sorted_result
540 SELECT * FROM federated.t1 WHERE id != 5; 
541 --sorted_result
542 SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; 
543 --sorted_result
544 SELECT * FROM federated.t1 WHERE id > 3 AND id <= 7; 
545 --sorted_result
546 SELECT * FROM federated.t1 WHERE id >= 3 AND id <= 7; 
547 SELECT * FROM federated.t1 WHERE id < 3 AND id <= 7; 
548 SELECT * FROM federated.t1 WHERE id < 3 AND id > 7; 
549 --sorted_result
550 SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; 
551 SELECT * FROM federated.t1 WHERE col2 = 'three Three'; 
552 --sorted_result
553 SELECT * FROM federated.t1 WHERE col2 > 'one'; 
554 --sorted_result
555 SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; 
556 SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; 
557 SELECT * FROM federated.t1 WHERE col2 LIKE 'se%'; 
558 --sorted_result
559 SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; 
560 --sorted_result
561 SELECT * FROM federated.t1 WHERE col2 <> 'one One'; 
563 # more multi-column indexes, in the primary key
564 connection slave;
565 DROP TABLE IF EXISTS federated.t1;
566 CREATE TABLE federated.t1 (
567   `col1` varchar(8) NOT NULL DEFAULT '',
568   `col2` varchar(128) NOT NULL DEFAULT '',
569   `col3` varchar(20) NOT NULL DEFAULT '',
570   `col4` varchar(40) NOT NULL DEFAULT '',
571   primary key (`col1`, `col2`, `col3`, `col4`),
572   key 3key(`col2`,`col3`,`col4`),
573   key 2key (`col3`,`col4`),
574   key col4(col4));
576 connection master;
577 DROP TABLE IF EXISTS federated.t1;
578 --replace_result $SLAVE_MYPORT SLAVE_PORT
579 eval CREATE TABLE federated.t1 (
580   `col1` varchar(8) NOT NULL DEFAULT '',
581   `col2` varchar(128) NOT NULL DEFAULT '',
582   `col3` varchar(20) NOT NULL DEFAULT '',
583   `col4` varchar(40) NOT NULL DEFAULT '',
584   primary key (`col1`, `col2`, `col3`, `col4`),
585   key 3key(`col2`,`col3`,`col4`),
586   key 2key (`col3`,`col4`),
587   key col4(col4))
588   ENGINE="FEDERATED"
589   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
591 INSERT INTO federated.t1 (col1, col2, col3, col4) 
592   VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac');
593 INSERT INTO federated.t1 (col1, col2, col3, col4) 
594   VALUES ('bbbb', 'bbbbbbbbbbbbbbbbbbb', 'bababababa', 'bcbcbcbcbcbcbcbc');
595 INSERT INTO federated.t1 (col1, col2, col3, col4) 
596   VALUES ('cccc', 'ccccccccccccccccccc', 'cacacacaca', 'cbcbcbcbcbcbcbcb');
597 INSERT INTO federated.t1 (col1, col2, col3, col4) 
598   VALUES ('dddd', 'ddddddddddddddddddd', 'dadadadada', 'dcdcdcdcdcdcdcdc');
599 INSERT INTO federated.t1 (col1, col2, col3, col4) 
600   VALUES ('eeee', 'eeeeeeeeeeeeeeeeeee', 'eaeaeaeaea', 'ecececececececec');
601 INSERT INTO federated.t1 (col1, col2, col3, col4) 
602   VALUES ('ffff', 'fffffffffffffffffff', 'fafafafafa', 'fcfcfcfcfcfcfcfc');
603 INSERT INTO federated.t1 (col1, col2, col3, col4) 
604   VALUES ('gggg', 'ggggggggggggggggggg', 'gagagagaga', 'gcgcgcgcgcgcgcgc');
605 INSERT INTO federated.t1 (col1, col2, col3, col4) 
606   VALUES ('hhhh', 'hhhhhhhhhhhhhhhhhhh', 'hahahahaha', 'hchchchchchchchc');
608 SELECT * FROM federated.t1 WHERE col1 = 'cccc'; 
609 SELECT * FROM federated.t1 WHERE col2 = 'eeeeeeeeeeeeeeeeeee'; 
610 SELECT * FROM federated.t1 WHERE col3 = 'bababababa'; 
611 SELECT * FROM federated.t1 WHERE col1 =  'gggg' AND col2 = 'ggggggggggggggggggg'; 
612 SELECT * FROM federated.t1 WHERE col1 =  'gggg' AND col3 = 'gagagagaga'; 
613 SELECT * FROM federated.t1 WHERE col1 =  'ffff' AND col4 = 'fcfcfcfcfcfcfcfc'; 
614 --sorted_result
615 SELECT * FROM federated.t1 WHERE col1 >  'bbbb';
616 --sorted_result
617 SELECT * FROM federated.t1 WHERE col1 >=  'bbbb';
618 SELECT * FROM federated.t1 WHERE col1 <  'bbbb';
619 --sorted_result
620 SELECT * FROM federated.t1 WHERE col1 <=  'bbbb';
621 --sorted_result
622 SELECT * FROM federated.t1 WHERE col1 <>  'bbbb';
623 SELECT * FROM federated.t1 WHERE col1 LIKE  'b%';
624 --sorted_result
625 SELECT * FROM federated.t1 WHERE col4 LIKE  '%b%';
626 --sorted_result
627 SELECT * FROM federated.t1 WHERE col1 NOT LIKE  'c%';
628 SELECT * FROM federated.t1 WHERE col4 NOT LIKE  '%c%';
629 connection slave;
630 DROP TABLE IF EXISTS federated.t1;
631 CREATE TABLE federated.t1 (
632   `col1` varchar(8) NOT NULL DEFAULT '',
633   `col2` int(8) NOT NULL DEFAULT 0,
634   `col3` varchar(8) NOT NULL DEFAULT '',
635   primary key (`col1`, `col2`, `col3`));
637 connection master;
638 DROP TABLE IF EXISTS federated.t1;
639 --replace_result $SLAVE_MYPORT SLAVE_PORT
640 eval CREATE TABLE federated.t1 (
641   `col1` varchar(8) NOT NULL DEFAULT '',
642   `col2` varchar(8) NOT NULL DEFAULT '',
643   `col3` varchar(8) NOT NULL DEFAULT '',
644   primary key (`col1`, `col2`, `col3`))
645   ENGINE="FEDERATED"
646   DEFAULT CHARSET=latin1
647   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
649 INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0');
650 INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc');
651 INSERT INTO federated.t1 VALUES ('bbb', '222', 'yyy');
652 INSERT INTO federated.t1 VALUES ('ccc', '111', 'zzz');
653 INSERT INTO federated.t1 VALUES ('ccd', '112', 'zzzz');
655 # let's see what the foreign database says 
656 connection slave;
657 --sorted_result
658 SELECT col3 FROM federated.t1 WHERE  (
659 (col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND 
660 (col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); 
662 connection master;
663 --sorted_result
664 SELECT col3 FROM federated.t1 WHERE  (
665 (col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND 
666 (col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); 
668 # test NULLs
669 connection slave;
670 DROP TABLE IF EXISTS federated.t1;
671 CREATE TABLE federated.t1 (
672     `id` int,
673     `name` varchar(32),
674     `floatval` float,
675     `other` int)
676 DEFAULT CHARSET=latin1;
678 connection master;
679 DROP TABLE IF EXISTS federated.t1;
680 --replace_result $SLAVE_MYPORT SLAVE_PORT
681 eval CREATE TABLE federated.t1 (
682     `id` int,
683     `name` varchar(32),
684     `floatval` float,
685     `other` int)
686 ENGINE="FEDERATED"
687 DEFAULT CHARSET=latin1
688 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
690 # these both should be the same
691 INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL);
692 INSERT INTO federated.t1 values ();
693 INSERT INTO federated.t1 (id) VALUES (1);
694 INSERT INTO federated.t1 (name, floatval, other)
695   VALUES ('foo', 33.33333332, NULL);
696 INSERT INTO federated.t1 (name, floatval, other)
697   VALUES (0, 00.3333, NULL);
698 --sorted_result
699 SELECT * FROM federated.t1;
700 SELECT count(*) FROM federated.t1 
701 WHERE id IS NULL 
702 AND name IS NULL 
703 AND floatval IS NULL
704 AND other IS NULL;
706 connection slave;
707 DROP TABLE IF EXISTS federated.t1;
708 CREATE TABLE federated.t1 (
709     `blurb_id` int NOT NULL DEFAULT 0,
710     `blurb` text default '',
711     PRIMARY KEY (blurb_id))
712   DEFAULT CHARSET=latin1; 
714 connection master;
715 DROP TABLE IF EXISTS federated.t1;
716 --replace_result $SLAVE_MYPORT SLAVE_PORT
717 eval CREATE TABLE federated.t1 (
718     `blurb_id` int NOT NULL DEFAULT 0,
719     `blurb` text default '',
720     PRIMARY KEY (blurb_id))
721   ENGINE="FEDERATED"
722   DEFAULT CHARSET=latin1
723   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; 
725 INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types.  This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements.  The overview is intentionally brief.  The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
726 INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
727 INSERT INTO federated.t1 VALUES (3, " A floating-point number.  p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following.  FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined.  ");
728 INSERT INTO federated.t1 VALUES(4, "Die ï¿½bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung.  Zumindest f�r jemanden, der seine Zielsprache ernst nimmt:");
729 --sorted_result
730 SELECT * FROM federated.t1;
732 connection slave;
733 DROP TABLE IF EXISTS federated.t1;
734 CREATE TABLE federated.t1 (
735     `a` int NOT NULL,
736     `b` int NOT NULL,
737     `c` int NOT NULL,
738     PRIMARY KEY (a),key(b));
740 connection master;
741 DROP TABLE IF EXISTS federated.t1;
742 --replace_result $SLAVE_MYPORT SLAVE_PORT
743 eval CREATE TABLE federated.t1 (
744     `a` int NOT NULL,
745     `b` int NOT NULL,
746     `c` int NOT NULL,
747     PRIMARY KEY (a),
748     KEY (b))
749   ENGINE="FEDERATED"
750   DEFAULT CHARSET=latin1
751   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
753 INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4);
755 connection slave;
756 DROP TABLE IF EXISTS federated.t1;
757 CREATE TABLE federated.t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
758 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
759 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
760 i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
761 int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
762 i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
763 int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
764 i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
765 int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
766 i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
767 int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
768 i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
769 int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
770 int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
771 int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
772 int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
773 int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
774 int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
775 int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
776 int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
777 int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
778 int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
779 int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
780 int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
781 int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
782 int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
783 int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
784 int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
785 int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
786 int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
787 int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
788 int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
789 int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
790 int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
791 int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
792 int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
793 int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
794 int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
795 int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
796 int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
797 int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
798 int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
799 int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
800 int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
801 int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
802 int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
803 int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
804 int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
805 int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
806 int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
807 int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
808 int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
809 int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
810 int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
811 int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
812 int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
813 int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
814 int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
815 int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
816 int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
817 int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
818 int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
819 int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
820 int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
821 int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
822 int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
823 int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
824 int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
825 int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
826 int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
827 int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
828 int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
829 int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
830 int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
831 int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
832 int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
833 int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
834 int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
835 int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
836 int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
837 int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
838 int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
839 int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
840 int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
841 int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
842 int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
843 int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
844 int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
845 int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
846 int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
847 int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
848 int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
849 int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
850 int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
851 int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
852 int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
853 int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
854 int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
855 int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
856 int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
857 int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
858 int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
859 int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
860 int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
861 int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
862 int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
863 int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
864 int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
865 int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
866 int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
867 int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
868 int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
869 int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
870 int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
871 int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
872 int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
873 int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
874 int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
875 int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
876 int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
877 int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
878 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
879 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
880 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
881 int, i999 int, i1000 int, b varchar(256)) row_format=dynamic;
883 connection master;
884 DROP TABLE IF EXISTS federated.t1;
885 --replace_result $SLAVE_MYPORT SLAVE_PORT
886 eval CREATE TABLE federated.t1 
887 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
888 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, 
889 i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
890 i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
891 int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
892 i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
893 int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
894 i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
895 int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
896 i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
897 int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
898 i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
899 int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
900 int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
901 int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
902 int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
903 int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
904 int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
905 int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
906 int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
907 int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
908 int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
909 int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
910 int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
911 int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
912 int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
913 int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
914 int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
915 int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
916 int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
917 int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
918 int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
919 int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
920 int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
921 int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
922 int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
923 int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
924 int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
925 int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
926 int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
927 int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
928 int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
929 int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
930 int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
931 int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
932 int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
933 int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
934 int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
935 int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
936 int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
937 int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
938 int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
939 int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
940 int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
941 int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
942 int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
943 int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
944 int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
945 int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
946 int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
947 int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
948 int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
949 int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
950 int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
951 int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
952 int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
953 int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
954 int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
955 int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
956 int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
957 int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
958 int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
959 int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
960 int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
961 int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
962 int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
963 int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
964 int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
965 int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
966 int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
967 int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
968 int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
969 int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
970 int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
971 int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
972 int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
973 int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
974 int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
975 int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
976 int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
977 int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
978 int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
979 int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
980 int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
981 int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
982 int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
983 int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
984 int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
985 int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
986 int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
987 int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
988 int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
989 int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
990 int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
991 int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
992 int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
993 int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
994 int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
995 int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
996 int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
997 int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
998 int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
999 int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
1000 int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
1001 int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
1002 int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
1003 int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
1004 int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
1005 int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
1006 int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
1007 int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
1008 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
1009 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
1010 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
1011 int, i999 int, i1000 int, b varchar(256))
1012 row_format=dynamic
1013 ENGINE="FEDERATED"
1014 DEFAULT CHARSET=latin1
1015 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1017 INSERT INTO federated.t1
1018 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1019 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1020 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1021 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1022 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1023 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1024 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1025 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1026 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1027 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1028 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1029 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1030 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1031 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1032 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1033 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1034 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1035 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1036 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1037 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1038 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1039 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1040 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1041 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1042 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1043 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1044 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1045 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1046 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1047 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1048 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1049 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1050 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1051 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1052 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1053 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1054 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1055 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1056 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "PatrickG");
1057 UPDATE federated.t1 SET b=repeat('a',256);
1058 UPDATE federated.t1 SET i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0, i10=0;
1059 SELECT * FROM federated.t1 WHERE i9=0 and i10=0;
1060 UPDATE federated.t1 SET i50=20;
1061 SELECT * FROM federated.t1;
1062 DELETE FROM federated.t1 WHERE i51=20;
1063 SELECT * FROM federated.t1;
1064 DELETE FROM federated.t1 WHERE i50=20;
1065 SELECT * FROM federated.t1;
1067 connection slave;
1068 DROP TABLE IF EXISTS federated.t1;
1069 CREATE TABLE federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', PRIMARY KEY(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1;
1071 connection master;
1072 DROP TABLE IF EXISTS federated.t1;
1073 --replace_result $SLAVE_MYPORT SLAVE_PORT
1074 eval CREATE TABLE federated.t1 (
1075     id int NOT NULL auto_increment,
1076     code char(20) NOT NULL,
1077     fileguts blob NOT NULL,
1078     creation_date datetime,
1079     entered_time datetime default '2004-04-04 04:04:04',
1080     PRIMARY KEY(id),
1081     index(code),
1082     index(fileguts(10)))
1083   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
1084   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; 
1085 INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2003-03-03 03:03:03');
1086 INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#<S-F8>*<S-F8><S-F8><S-F8>#<S-F8>#<S-F8>#<S-F8>[[', '2004-04-04 04:04:04');
1087 INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04');
1088 --sorted_result
1089 SELECT * FROM federated.t1;
1090 # test blob indexes
1091 SELECT * FROM federated.t1 WHERE fileguts = 'jimbob';
1093 # test blob with binary
1094 connection slave;
1095 DROP TABLE IF EXISTS federated.t1;
1096 CREATE TABLE federated.t1 (`a` BLOB);
1098 connection master;
1099 DROP TABLE IF EXISTS federated.t1;
1100 --replace_result $SLAVE_MYPORT SLAVE_PORT
1101 eval CREATE TABLE federated.t1 (
1102   `a` BLOB)
1103 ENGINE="FEDERATED"
1104 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1106 INSERT INTO federated.t1 VALUES (0x00);
1107 INSERT INTO federated.t1 VALUES (0x0001);
1108 INSERT INTO federated.t1 VALUES (0x0100);
1109 --sorted_result
1110 SELECT HEX(a) FROM federated.t1;
1112 # # simple tests for cyrillic, given to me by 
1113 # DROP TABLE IF EXISTS federated.t1;
1114 # --replace_result $SLAVE_MYPORT SLAVE_PORT
1115 # eval CREATE TABLE federated.t1
1116 #  (a char(20)) charset=cp1251
1117 #  ENGINE="FEDERATED" CONNECTION="mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1";
1118 # # 
1119 #  connection slave;
1120 # DROP TABLE IF EXISTS federated.t1;
1121 # CREATE TABLE federated.t1 (a char(20)) charset=cp1251;
1122 # # 
1123 #  connection master;
1124 # INSERT INTO federated.t1 values (_cp1251'�-���-1');
1125 # INSERT INTO federated.t1 values (_cp1251'�-���-2');
1126 # SELECT * FROM federated.t1;
1127 # SET names cp1251;
1128 # INSERT INTO federated.t1 values ('�-���-3');
1129 # INSERT INTO federated.t1 values ('�-Ũ�-4');
1130 # SELECT * FROM federated.t1;
1131 # SELECT hex(a) from federated.t1;
1132 # SELECT hex(a) from federated.t1 ORDER BY a desc;
1133 # UPDATE federated.t1 SET a='�-���-1�����' WHERE a='�-���-1';
1134 # SELECT * FROM federated.t1;
1135 # DELETE FROM federated.t1 WHERE a='�-Ũ�-4';
1136 # SELECT * FROM federated.t1;
1137 # DELETE FROM federated.t1 WHERE a>'�-';
1138 # SELECT * FROM federated.t1;
1139 # SET names default;
1140 # DROP TABLE IF EXISTS federated.t1;
1143 # DROP TABLE IF EXISTS federated.t1;
1146 # test joins with non-federated table
1147 connection slave;
1148 DROP TABLE IF EXISTS federated.t1;
1149 CREATE TABLE federated.t1 (
1150     `id` int(20) NOT NULL auto_increment,
1151     `country_id` int(20) NOT NULL DEFAULT 0,
1152     `name` varchar(32),
1153     `other` varchar(20),
1154     PRIMARY KEY  (`id`),
1155     key (country_id));
1157 connection master;
1158 DROP TABLE IF EXISTS federated.countries;
1159 CREATE TABLE federated.countries (
1160     `id` int(20) NOT NULL auto_increment,
1161     `country` varchar(32),
1162     PRIMARY KEY (id));
1163 INSERT INTO federated.countries (country) VALUES ('India');
1164 INSERT INTO federated.countries (country) VALUES ('Germany');
1165 INSERT INTO federated.countries (country) VALUES ('Italy');
1166 INSERT INTO federated.countries (country) VALUES ('Finland');
1167 INSERT INTO federated.countries (country) VALUES ('Ukraine');
1169 DROP TABLE IF EXISTS federated.t1;
1170 --replace_result $SLAVE_MYPORT SLAVE_PORT
1171 eval CREATE TABLE federated.t1 (
1172     `id` int(20) NOT NULL auto_increment,
1173     `country_id` int(20) NOT NULL DEFAULT 0,
1174     `name` varchar(32),
1175     `other` varchar(20),
1176     PRIMARY KEY  (`id`),
1177     KEY (country_id) )
1178   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
1179   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1181 INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111);
1182 INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222);
1183 INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333);
1184 INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333);
1185 INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333);
1187 #inner join
1188 --sorted_result
1189 SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
1190 federated.t1.other AS other, federated.countries.country AS country 
1191 FROM federated.t1, federated.countries WHERE
1192 federated.t1.country_id = federated.countries.id;
1194 SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
1195 federated.t1.other AS other, federated.countries.country AS country
1196 FROM federated.t1 INNER JOIN federated.countries ON
1197 federated.t1.country_id = federated.countries.id;
1199 SELECT federated.t1.name AS name, federated.t1.country_id AS country_id,
1200 federated.t1.other AS other, federated.countries.country AS country
1201 FROM federated.t1 INNER JOIN federated.countries ON
1202 federated.t1.country_id = federated.countries.id
1203 WHERE federated.t1.name = 'Monty';
1205 #left join
1206 SELECT federated.t1.*, federated.countries.country 
1207 FROM federated.t1 LEFT JOIN federated.countries 
1208 ON federated.t1.country_id = federated.countries.id
1209 ORDER BY federated.countries.id;
1211 SELECT federated.t1.*, federated.countries.country 
1212 FROM federated.t1 LEFT JOIN federated.countries 
1213 ON federated.t1.country_id = federated.countries.id
1214 ORDER BY federated.countries.country;
1216 #right join
1217 SELECT federated.t1.*, federated.countries.country 
1218 FROM federated.t1 RIGHT JOIN federated.countries 
1219 ON federated.t1.country_id = federated.countries.id 
1220 ORDER BY federated.t1.country_id;
1222 DROP TABLE federated.countries;
1224 #BEGIN optimize and repair tests
1225 OPTIMIZE TABLE federated.t1;
1226 REPAIR TABLE federated.t1;
1227 REPAIR TABLE federated.t1 QUICK;
1228 REPAIR TABLE federated.t1 EXTENDED;
1229 REPAIR TABLE federated.t1 USE_FRM;
1230 #END optimize and repair tests
1233 # BEGIN ALTER TEST
1234 connection slave;
1235 --disable_warnings
1236 DROP TABLE IF EXISTS federated.normal_table;
1237 --enable_warnings
1239 CREATE TABLE federated.normal_table (
1240   `id` int(4) NOT NULL,
1241   `name` varchar(10) default NULL
1242   ) DEFAULT CHARSET=latin1;
1244 connection master;
1245 --disable_warnings
1246 DROP TABLE IF EXISTS federated.alter_me;
1247 --enable_warnings
1249 --replace_result $SLAVE_MYPORT SLAVE_PORT
1250 eval CREATE TABLE federated.alter_me (
1251   `id` int(4) NOT NULL,
1252   `name` varchar(10) default NULL,
1253   PRIMARY KEY (`id`)
1254   ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
1255   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/normal_table';
1257 INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty');
1258 INSERT INTO federated.alter_me (id, name) VALUES (2, 'David');
1260 SELECT * FROM federated.alter_me;
1262 --error ER_ILLEGAL_HA
1263 ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL;
1265 SELECT * FROM federated.alter_me;
1267 DROP TABLE federated.alter_me;
1268 connection slave;
1269 DROP TABLE federated.normal_table;
1270 # END ALTER TEST
1273 # Test BUG #14532 - bit columns broken in federated
1274 # storage engine
1276 --disable_warnings
1277 DROP TABLE IF EXISTS federated.t1;
1278 --enable_warnings
1279 CREATE TABLE federated.t1 (
1280   `bitty` bit(3)
1281 ) DEFAULT CHARSET=latin1;
1283 connection master;
1285 --disable_warnings
1286 DROP TABLE IF EXISTS federated.t1;
1287 --enable_warnings
1289 --replace_result $SLAVE_MYPORT SLAVE_PORT
1290 eval CREATE TABLE federated.t1 (
1291  `bitty` bit(3)
1292 ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1
1293   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1295 INSERT INTO federated.t1 VALUES (b'001');
1296 INSERT INTO federated.t1 VALUES (b'010');
1297 INSERT INTO federated.t1 VALUES (b'011');
1298 INSERT INTO federated.t1 VALUES (b'100');
1299 INSERT INTO federated.t1 VALUES (b'101');
1300 INSERT INTO federated.t1 VALUES (b'110');
1301 INSERT INTO federated.t1 VALUES (b'111');
1302 select * FROM federated.t1;
1303 drop table federated.t1;
1305 connection slave;
1306 drop table federated.t1;
1309 # BUG# 14768 test auto_increment last_insert_id()
1311 connection slave;
1312 DROP TABLE IF EXISTS federated.t1;
1313 CREATE TABLE federated.t1 (
1314     `id` int(20) NOT NULL auto_increment,
1315     PRIMARY KEY  (`id`));
1317 connection master;
1318 DROP TABLE IF EXISTS federated.t1;
1319 --replace_result $SLAVE_MYPORT SLAVE_PORT
1320 eval CREATE TABLE federated.t1 (
1321     `id` int(20) NOT NULL auto_increment,
1322     PRIMARY KEY  (`id`)
1323     )
1324   ENGINE="FEDERATED" DEFAULT CHARSET=latin1
1325   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1327 INSERT INTO federated.t1 VALUES ();
1328 SELECT LAST_INSERT_ID();
1329 INSERT INTO federated.t1 VALUES ();
1330 SELECT LAST_INSERT_ID();
1331 INSERT INTO federated.t1 VALUES ();
1332 SELECT LAST_INSERT_ID();
1333 INSERT INTO federated.t1 VALUES ();
1334 SELECT LAST_INSERT_ID();
1335 INSERT INTO federated.t1 VALUES ();
1336 SELECT LAST_INSERT_ID();
1337 SELECT * FROM federated.t1;
1338 DROP TABLE federated.t1;
1340 connection slave;
1341 DROP TABLE federated.t1;
1344 # Bug#17377 Federated Engine returns wrong Data, always the rows
1345 #           with the highest ID
1348 connection slave;
1350 --disable_warnings
1351 DROP TABLE IF EXISTS federated.bug_17377_table;
1352 --enable_warnings
1354 CREATE TABLE federated.bug_17377_table (
1355 `fld_cid` bigint(20) NOT NULL auto_increment,
1356 `fld_name` varchar(255) NOT NULL default '',
1357 `fld_parentid` bigint(20) NOT NULL default '0',
1358 `fld_delt` int(1) NOT NULL default '0',
1359 PRIMARY KEY (`fld_cid`),
1360 KEY `fld_parentid` (`fld_parentid`),
1361 KEY `fld_delt` (`fld_delt`),
1362 KEY `fld_cid` (`fld_cid`)
1363 ) ENGINE=MyISAM;
1365 # Insert some test-data
1366 insert into federated.bug_17377_table( fld_name )
1367 values
1368 ("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel");
1370 connection master;
1371 --disable_warnings
1372 DROP TABLE IF EXISTS federated.t1;
1373 --enable_warnings
1375 --replace_result $SLAVE_MYPORT SLAVE_PORT
1376 eval CREATE TABLE federated.t1 (
1377 `fld_cid` bigint(20) NOT NULL auto_increment,
1378 `fld_name` varchar(255) NOT NULL default '',
1379 `fld_parentid` bigint(20) NOT NULL default '0',
1380 `fld_delt` int(1) NOT NULL default '0',
1381 PRIMARY KEY (`fld_cid`),
1382 KEY `fld_parentid` (`fld_parentid`),
1383 KEY `fld_delt` (`fld_delt`),
1384 KEY `fld_cid` (`fld_cid`)
1385 ) ENGINE=FEDERATED
1386 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_17377_table';
1388 select * from federated.t1 where fld_parentid=0 and fld_delt=0
1389 order by fld_name;
1391 select * from federated.t1 where fld_parentid=0 and fld_delt=0;
1393 DROP TABLE federated.t1;
1394 connection slave;
1395 DROP TABLE federated.bug_17377_table;
1398 # Test multi updates and deletes without keys
1401 # The following can be enabled when bug #19773 has been fixed
1402 --disable_parsing
1403 connection slave;
1404 create table federated.t1 (i1 int, i2 int, i3 int);
1405 create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
1406 connection master;
1407 eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1408 eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
1409 insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
1410 insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
1411 select * from federated.t1 order by i1;
1412 select * from federated.t2;
1413 update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
1414 select * from federated.t1 order by i1;
1415 select * from federated.t2 order by id;
1416 delete   t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
1417 select * from federated.t1 order by i1;
1418 select * from federated.t2 order by id;
1419 drop table federated.t1, federated.t2;
1420 connection slave;
1421 drop table federated.t1, federated.t2;
1422 connection master;
1424 # Test multi updates and deletes with keys
1426 connection slave;
1427 create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
1428 create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));
1429 connection master;
1430 eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1431 eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
1432 insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
1433 insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
1434 select * from federated.t1 order by i1;
1435 select * from federated.t2 order by id;
1436 update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
1437 select * from federated.t1 order by i1;
1438 select * from federated.t2 order by id;
1439 delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
1440 select * from federated.t1 order by i1;
1441 select * from federated.t2 order by id;
1442 drop table federated.t1, federated.t2;
1443 connection slave;
1444 drop table federated.t1, federated.t2;
1445 connection master;
1446 --enable_parsing
1449 # BUG #18764: Delete conditions causing inconsistencies in Federated tables
1451 connection slave;
1452 --disable_warnings
1453 DROP TABLE IF EXISTS federated.test;
1454 --enable_warnings
1455 CREATE TABLE federated.test (
1456     `id` int(11) NOT NULL,
1457     `val1` varchar(255) NOT NULL,
1458     `val2` varchar(255) NOT NULL,
1459     PRIMARY KEY  (`id`)
1460     ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
1462 connection master;
1463 --disable_warnings
1464 DROP TABLE IF EXISTS federated.test_local;
1465 DROP TABLE IF EXISTS federated.test_remote;
1466 --enable_warnings
1467 CREATE TABLE federated.test_local (
1468   `id` int(11) NOT NULL,
1469   `val1` varchar(255) NOT NULL,
1470   `val2` varchar(255) NOT NULL,
1471   PRIMARY KEY  (`id`)
1472 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
1474 INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'),
1475 (2, 'bar', 'foo');
1477 --replace_result $SLAVE_MYPORT SLAVE_PORT
1478 eval CREATE TABLE federated.test_remote (
1479   `id` int(11) NOT NULL,
1480   `val1` varchar(255) NOT NULL,
1481   `val2` varchar(255) NOT NULL,
1482   PRIMARY KEY  (`id`)
1483 ) ENGINE=FEDERATED DEFAULT CHARSET=latin1
1484 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test';
1486 insert into federated.test_remote select * from federated.test_local;
1488 select * from federated.test_remote;
1490 delete from federated.test_remote where id in (1,2);
1492 insert into federated.test_remote select * from federated.test_local;
1494 select * from federated.test_remote;
1495 --disable_warnings
1496 DROP TABLE federated.test_local;
1497 DROP TABLE federated.test_remote;
1498 --enable_warnings
1499 connection slave;
1500 --disable_warnings
1501 DROP TABLE federated.test;
1502 --enable_warnings
1505 # Additional test for bug#18437 "Wrong values inserted with a before
1506 # update trigger on NDB table". SQL-layer didn't properly inform
1507 # handler about fields which were read and set in triggers. In some
1508 # cases this resulted in incorrect (garbage) values of OLD variables
1509 # and lost changes to NEW variables.
1510 # Since for federated engine only operation which is affected by wrong
1511 # fields mark-up is handler::write_row() this file constains coverage
1512 # for ON INSERT triggers only. Tests for other types of triggers reside
1513 # in ndb_trigger.test.
1515 connection slave;
1516 --disable_warnings
1517 drop table if exists federated.t1;
1518 --enable_warnings
1519 create table federated.t1 (a int, b int, c int);
1520 connection master;
1521 --disable_warnings
1522 drop table if exists federated.t1;
1523 drop table if exists federated.t2;
1524 --enable_warnings
1525 --replace_result $SLAVE_MYPORT SLAVE_PORT
1526 eval create table federated.t1 (a int,  b int, c int) engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1527 create trigger federated.t1_bi before insert on federated.t1 for each row set new.c= new.a * new.b;
1528 create table federated.t2 (a int, b int);
1529 insert into federated.t2 values (13, 17), (19, 23);
1530 # Each of three statements should correctly set values for all three fields
1531 # insert
1532 insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11);
1533 select * from federated.t1 order by a;
1534 delete from federated.t1;
1535 # insert ... select
1536 insert into federated.t1 (a, b) select * from federated.t2;
1537 select * from federated.t1 order by a;
1538 delete from federated.t1;
1539 # load
1540 load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
1541 select * from federated.t1 order by a;
1542 drop tables federated.t1, federated.t2;
1544 connection slave;
1545 drop table federated.t1;
1548 # BUG 19773 Crash when using multi-table updates, deletes
1549 # with federated tables
1551 connection slave;
1552 create table federated.t1 (i1 int, i2 int, i3 int);
1553 create table federated.t2 (id int, c1 varchar(20), c2 varchar(20));
1555 connection master;
1556 --replace_result $SLAVE_MYPORT SLAVE_PORT
1557 eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1558 --replace_result $SLAVE_MYPORT SLAVE_PORT
1559 eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
1560 insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
1561 insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
1562 select * from federated.t1 order by i1;
1563 select * from federated.t2;
1564 update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
1565 select * from federated.t1 order by i1;
1566 select * from federated.t2 order by id;
1567 delete   federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
1568 select * from federated.t1 order by i1;
1569 select * from federated.t2 order by id;
1570 drop table federated.t1, federated.t2;
1571 connection slave;
1572 drop table federated.t1, federated.t2;
1574 # Test multi updates and deletes with keys
1575 connection slave;
1576 create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1));
1577 create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id));
1579 connection master;
1580 --replace_result $SLAVE_MYPORT SLAVE_PORT
1581 eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1582 --replace_result $SLAVE_MYPORT SLAVE_PORT
1583 eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2';
1584 insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
1585 insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
1586 select * from federated.t1 order by i1;
1587 select * from federated.t2 order by id;
1588 update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
1589 select * from federated.t1 order by i1;
1590 select * from federated.t2 order by id;
1591 delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id;
1592 select * from federated.t1 order by i1;
1593 select * from federated.t2 order by id;
1594 drop table federated.t1, federated.t2;
1596 connection slave;
1597 drop table federated.t1, federated.t2;
1599 # Bug #16494: Updates that set a column to NULL fail sometimes
1601 connection slave;
1602 create table t1 (id int not null auto_increment primary key, val int);
1603 connection master;
1604 --replace_result $SLAVE_MYPORT SLAVE_PORT
1605 eval create table t1
1606   (id int not null auto_increment primary key, val int) engine=federated
1607   connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
1608 insert into t1 values (1,0),(2,0);
1609 update t1 set val = NULL where id = 1;
1610 select * from t1;
1611 connection slave;
1612 select * from t1;
1613 drop table t1;
1614 connection master;
1615 drop table t1;
1618 # Bug #17608: String literals lost during INSERT query on FEDERATED table
1620 connection slave;
1621 create table t1 (a longblob not null);
1622 connection master;
1623 --replace_result $SLAVE_MYPORT SLAVE_PORT
1624 eval create table t1
1625   (a longblob not null) engine=federated
1626   connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
1627 insert into t1 values (repeat('a',5000));
1628 select length(a) from t1;
1629 connection slave;
1630 select length(a) from t1;
1631 drop table t1;
1632 connection master;
1633 drop table t1;
1636 # BUG #15133: unique index with nullable value not accepted in federated table 
1639 connection slave;
1640 --disable_warnings
1641 DROP TABLE IF EXISTS federated.test;
1642 CREATE TABLE federated.test (
1643   `i` int(11) NOT NULL,
1644   `j` int(11) NOT NULL,
1645   `c` varchar(30) default NULL,
1646   PRIMARY KEY  (`i`,`j`),
1647   UNIQUE KEY `i` (`i`,`c`)
1648 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
1649 --enable_warnings
1651 connection master;
1652 --disable_warnings
1653 DROP TABLE IF EXISTS federated.test1;
1654 DROP TABLE IF EXISTS federated.test2;
1655 --enable_warnings
1657 --replace_result $SLAVE_MYPORT SLAVE_PORT
1658 eval create table federated.test1 (
1659         i int not null,
1660         j int not null,
1661         c varchar(30),
1662         primary key (i,j),
1663         unique key (i, c))
1664 engine = federated
1665 connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test';
1667 --replace_result $SLAVE_MYPORT SLAVE_PORT
1668 eval create table federated.test2 (
1669         i int default null,
1670         j int not null,
1671         c varchar(30),
1672         key (i))
1673 engine = federated
1674 connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test';
1675 drop table federated.test1, federated.test2;
1677 connection slave;
1678 drop table federated.test;
1681 # BUG# 17044 Federated Storage Engine not UTF8 clean
1683 connection slave;
1684 set names utf8;
1685 create table federated.t1 (a varchar(64)) DEFAULT CHARSET=utf8;
1687 insert into federated.t1 values (0x6DC3A56E6164);
1688 select hex(a) from federated.t1;
1690 connection master;
1691 --replace_result $SLAVE_MYPORT SLAVE_PORT
1692 eval create table federated.t1 (a varchar(64))
1693 ENGINE=FEDERATED 
1694 connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
1695 DEFAULT CHARSET=utf8;
1696 set names utf8;
1697 select hex(a) from federated.t1;
1698 insert into federated.t1 values (0xC3A4C3B6C3BCC39F);
1699 insert into federated.t1 values (0xD18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E);
1700 select hex(a) from federated.t1;
1702 connection slave;
1703 select hex(a) from federated.t1;
1705 connection master;
1706 drop table federated.t1;
1708 connection slave;
1709 drop table federated.t1;
1712 # Bug#26909: Specified key was too long; max key length is 255 bytes 
1713 #       when creating a table
1715 connection slave;
1716 CREATE TABLE federated.t1 (
1717     categoryId int(11) NOT NULL AUTO_INCREMENT,
1718     domainId varchar(745) NOT NULL DEFAULT '',
1719     categoryName varchar(255) NOT NULL DEFAULT '',
1720     PRIMARY KEY (categoryId),
1721     UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
1722     KEY idx_category_domainId (domainId)
1723   ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
1725 connection master;
1726 --replace_result $SLAVE_MYPORT SLAVE_PORT
1727 eval CREATE TABLE federated.t1 (
1728     categoryId int(11) NOT NULL AUTO_INCREMENT,
1729     domainId varchar(745) NOT NULL DEFAULT '',
1730     categoryName varchar(255) NOT NULL DEFAULT '',
1731     PRIMARY KEY (categoryId),
1732     UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName),
1733     KEY idx_category_domainId (domainId)
1734   ) ENGINE=FEDERATED DEFAULT CHARSET=latin1
1735   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1738 insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231  300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345  250');
1739 insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312  301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456  250');
1740 insert into federated.t1 (domainId, categoryName) values ('a', 'b');
1742 select categoryId from federated.t1 order by domainId, categoryName;
1743 select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
1744 select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId;
1745 select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId;
1747 drop table federated.t1;
1749 connection slave;
1750 drop table federated.t1;
1753 # BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE
1755 connection slave;
1756 create table federated.t1 (a int primary key, b varchar(64))
1757   DEFAULT CHARSET=utf8;
1758 connection master;
1759 --replace_result $SLAVE_MYPORT SLAVE_PORT
1760 eval create table federated.t1 (a int primary key, b varchar(64))
1761   ENGINE=FEDERATED
1762   connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
1763   DEFAULT CHARSET=utf8;
1765 insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
1766 select * from federated.t1;
1768 truncate federated.t1;
1769 replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe");
1770 select * from federated.t1;
1772 update ignore federated.t1 set a=a+1;
1773 select * from federated.t1;
1775 drop table federated.t1;
1776 connection slave;
1777 drop table federated.t1;
1780 # BUG#25511 Federated Insert failures.
1782 # When the user performs a INSERT...ON DUPLICATE KEY UPDATE, we want
1783 # it to fail if a duplicate key exists instead of ignoring it.
1785 connection slave;
1786 create table federated.t1 (a int primary key, b varchar(64))
1787   DEFAULT CHARSET=utf8;
1788 connection master;
1789 --replace_result $SLAVE_MYPORT SLAVE_PORT
1790 eval create table federated.t1 (a int primary key, b varchar(64))
1791   ENGINE=FEDERATED
1792   connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
1793   DEFAULT CHARSET=utf8;
1795 --error ER_DUP_KEY
1796 insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe")
1797 on duplicate key update a=a+100;
1798 select * from federated.t1;
1800 drop table federated.t1;
1801 connection slave;
1802 drop table federated.t1;
1804 --echo
1805 --echo Bug#18287 create federated table always times out, error 1159 ' '
1806 --echo
1807 --echo Test that self-references work
1808 --echo
1809 connection slave;
1810 create table federated.t1 (a int primary key);
1811 --replace_result $SLAVE_MYPORT SLAVE_PORT
1812 eval create table federated.t2 (a int primary key)
1813   ENGINE=FEDERATED
1814   connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1815 insert into federated.t1 (a) values (1);
1816 select * from federated.t2;
1817 drop table federated.t1, federated.t2;
1820 # BUG#29875 Disable support for transactions
1822 connection slave;
1823 CREATE TABLE federated.t1 (a INT PRIMARY KEY) DEFAULT CHARSET=utf8;
1824 connection master;
1825 --replace_result $SLAVE_MYPORT SLAVE_PORT
1826 eval CREATE TABLE federated.t1 (a INT PRIMARY KEY)
1827   ENGINE=FEDERATED
1828   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'
1829   DEFAULT CHARSET=utf8;
1831 SELECT transactions FROM information_schema.engines WHERE engine="FEDERATED";
1832 INSERT INTO federated.t1 VALUES (1);
1833 SET autocommit=0;
1834 INSERT INTO federated.t1 VALUES (2);
1835 ROLLBACK;
1836 SET autocommit=1;
1837 SELECT * FROM federated.t1;
1839 DROP TABLE federated.t1;
1840 connection slave;
1841 DROP TABLE federated.t1;
1844 # Bug #32374 crash with filesort when selecting from federated table and view
1846 connection slave;
1847 create table t1 (a varchar(256));
1848 --disable_warnings
1849 drop view if exists v1;
1850 --enable_warnings
1851 create view v1 as select a from t1;
1852 --disable_query_log
1853 let $n= 100;
1854 while ($n)
1856   insert into t1 values (repeat('a',200));
1857   dec $n;
1859 --enable_query_log
1861 connection master;
1862 --replace_result $SLAVE_MYPORT SLAVE_PORT
1863 eval create table t1
1864   (a varchar(256)) engine=federated
1865   connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/v1';
1867 select 1 from t1 order by a;
1868 drop table t1;
1869 connection slave;
1870 drop table t1;
1871 drop view v1;
1874 # BUG#33946 - Join on Federated tables with Unique index gives error 1430
1875 #             from storage engine
1877 connection slave;
1878 CREATE TABLE t1 (a INT, b INT, KEY(a,b));
1879 INSERT INTO t1 VALUES(NULL,1),(1,NULL),(NULL,NULL),(1,1),(2,2);
1881 connection master;
1882 --replace_result $SLAVE_MYPORT SLAVE_PORT
1883 eval CREATE TABLE t1 (a INT, b INT, KEY(a,b)) ENGINE=federated
1884 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
1885 SELECT * FROM t1 WHERE a IS NULL;
1886 SELECT * FROM t1 WHERE a IS NOT NULL;
1887 SELECT * FROM t1 WHERE a=1 AND b=1;
1888 SELECT * FROM t1 WHERE a IS NULL AND b=1;
1889 SELECT * FROM t1 WHERE a IS NOT NULL AND b=1;
1890 DROP TABLE t1;
1892 connection slave;
1893 DROP TABLE t1;
1896 # BUG#34788 - malformed federated connection url is not handled correctly -
1897 #             crashes server !
1899 # also tests
1901 # BUG#35509 - Federated leaks memory when connecting to localhost/default
1902 #             port
1904 CREATE TABLE t1 (a INT) ENGINE=federated CONNECTION='mysql://@:://';
1905 DROP TABLE t1;
1909 # Bug #34779: crash in checksum table on federated tables with blobs 
1910 # containing nulls
1912 connection slave;
1913 CREATE TABLE t1 (a LONGBLOB, b LONGBLOB);
1914 INSERT INTO t1 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaa', NULL);
1915 connection master;
1916 --replace_result $SLAVE_MYPORT SLAVE_PORT
1917 eval CREATE TABLE t1
1918   (a LONGBLOB, b LONGBLOB) ENGINE=FEDERATED
1919   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
1920 CHECKSUM TABLE t1;
1921 connection slave;
1922 DROP TABLE t1;
1923 connection master;
1924 DROP TABLE t1;
1928 # Bug #34774    key prefix on text field in federated tables can cause
1929 # server to crash!
1931 connection slave;
1932 CREATE TABLE t1 (a TEXT, b TEXT, KEY(b(1)));
1933 INSERT INTO t1 VALUES (NULL, NULL), (NULL, NULL), (NULL, NULL), (NULL, NULL);
1934 connection master;
1935 --replace_result $SLAVE_MYPORT SLAVE_PORT
1936 eval CREATE TABLE t1
1937   (a TEXT, b TEXT, KEY(b(1))) ENGINE=FEDERATED
1938   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
1939 SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b;
1940 connection slave;
1941 DROP TABLE t1;
1942 connection master;
1943 DROP TABLE t1;
1945 --echo #
1946 --echo # BUG#21360 - mysqldump error on federated tables
1947 --echo #
1948 connection slave;
1949 --echo #Switch to Connection Slave
1950 CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
1951 INSERT INTO  t1 VALUES ('text1'),('text2'),('text3'),('text4');
1953 connection master;
1954 --echo #Switch to Connection Master
1955 --replace_result $SLAVE_MYPORT SLAVE_PORT
1956 eval CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED 
1957   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
1958 --echo # Dump table t1 using mysqldump tool
1959 --replace_result $SLAVE_MYPORT SLAVE_PORT
1960 --exec $MYSQL_DUMP --compact test t1
1961 DROP TABLE t1;
1963 connection slave;
1964 --echo #Switch to Connection Slave
1965 DROP TABLE t1;
1967 connection default;
1969 --echo End of 5.0 tests
1971 create server 's1' foreign data wrapper 'mysql' options (port 3306);
1972 drop server 's1';
1975 --echo #
1976 --echo # Bug #32426: FEDERATED query returns corrupt results for ORDER BY on a TEXT
1977 --echo #
1978 connection slave;
1979 CREATE TABLE federated.t1(a TEXT);
1980 INSERT INTO federated.t1 VALUES('abc'), ('gh'), ('f'), ('ijk'), ('de');
1982 connection master;
1983 --replace_result $SLAVE_MYPORT SLAVE_PORT
1984 eval CREATE TABLE federated.t1(a TEXT) ENGINE=FEDERATED
1985   CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1';
1986 SELECT * FROM federated.t1 ORDER BY A;
1987 SELECT * FROM federated.t1 ORDER BY A DESC;
1988 DROP TABLE federated.t1;
1990 connection slave;
1991 DROP TABLE federated.t1;
1993 connection default;
1996 --echo End of 5.1 tests
1997 SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
1998 connection slave;
1999 SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
2001 connection default;
2002 source suite/federated/include/federated_cleanup.inc;