474
449
insert t1 select a+1, a+b from t1;
475
450
insert t1 select a+1, a+b from t1;
478
452
show status like 'Slow_queries';
479
453
select count(*) from t1 where a=7;
481
454
show status like 'Slow_queries';
482
455
select count(*) from t1 where b=13;
484
456
show status like 'Slow_queries';
485
457
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
487
458
show status like 'Slow_queries';
488
459
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
490
460
show status like 'Slow_queries';
491
461
# additional test for examined rows
493
463
select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
495
464
show status like 'Slow_queries';
499
468
# Column 'name' cannot be null (error with union and left join) (bug #2508)
502
471
insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
503
472
select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);