7
7
drop table if exists t1, t2, t3, t1i, t2i, t3i;
10
create table t1 (a1 char(8), a2 char(8));
11
create table t2 (b1 char(8), b2 char(8));
12
create table t3 (c1 char(8), c2 char(8));
10
create table t1 (a1 char(8), a2 char(8)) ENGINE=MyISAM;
11
create table t2 (b1 char(8), b2 char(8)) ENGINE=MyISAM;
12
create table t3 (c1 char(8), c2 char(8)) ENGINE=MyISAM;
14
14
insert into t1 values ('1 - 00', '2 - 00');
15
15
insert into t1 values ('1 - 01', '2 - 01');
27
27
insert into t3 values ('1 - 04', '2 - 04');
30
create table t1i (a1 char(8), a2 char(8));
31
create table t2i (b1 char(8), b2 char(8));
32
create table t3i (c1 char(8), c2 char(8));
30
create table t1i (a1 char(8), a2 char(8)) ENGINE=MyISAM;
31
create table t2i (b1 char(8), b2 char(8)) ENGINE=MyISAM;
32
create table t3i (c1 char(8), c2 char(8)) ENGINE=MyISAM;
33
33
create index it1i1 on t1i (a1);
34
34
create index it1i2 on t1i (a2);
35
35
create index it1i3 on t1i (a1, a2);
268
268
set @blob_len = 16;
269
269
set @suffix_len = @blob_len - @prefix_len;
271
create table t1_16 (a1 blob, a2 blob);
272
create table t2_16 (b1 blob, b2 blob);
273
create table t3_16 (c1 blob, c2 blob);
271
create table t1_16 (a1 blob, a2 blob) ENGINE=MyISAM;
272
create table t2_16 (b1 blob, b2 blob) ENGINE=MyISAM;
273
create table t3_16 (c1 blob, c2 blob) ENGINE=MyISAM;
275
275
insert into t1_16 values
276
276
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
361
361
set @blob_len = 512;
362
362
set @suffix_len = @blob_len - @prefix_len;
364
create table t1_512 (a1 blob, a2 blob);
365
create table t2_512 (b1 blob, b2 blob);
366
create table t3_512 (c1 blob, c2 blob);
364
create table t1_512 (a1 blob, a2 blob) ENGINE=MyISAM;
365
create table t2_512 (b1 blob, b2 blob) ENGINE=MyISAM;
366
create table t3_512 (c1 blob, c2 blob) ENGINE=MyISAM;
368
368
insert into t1_512 values
369
369
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
443
443
set @blob_len = 1024;
444
444
set @suffix_len = @blob_len - @prefix_len;
446
create table t1_1024 (a1 blob, a2 blob);
447
create table t2_1024 (b1 blob, b2 blob);
448
create table t3_1024 (c1 blob, c2 blob);
446
create table t1_1024 (a1 blob, a2 blob) ENGINE=MyISAM;
447
create table t2_1024 (b1 blob, b2 blob) ENGINE=MyISAM;
448
create table t3_1024 (c1 blob, c2 blob) ENGINE=MyISAM;
450
450
insert into t1_1024 values
451
451
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
525
525
set @blob_len = 1025;
526
526
set @suffix_len = @blob_len - @prefix_len;
528
create table t1_1025 (a1 blob, a2 blob);
529
create table t2_1025 (b1 blob, b2 blob);
530
create table t3_1025 (c1 blob, c2 blob);
528
create table t1_1025 (a1 blob, a2 blob) ENGINE=MyISAM;
529
create table t2_1025 (b1 blob, b2 blob) ENGINE=MyISAM;
530
create table t3_1025 (c1 blob, c2 blob) ENGINE=MyISAM;
532
532
insert into t1_1025 values
533
533
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
601
601
where a1 in (select group_concat(b1) from t2_1025 group by b2);
603
603
drop table t1_1025, t2_1025, t3_1025;
605
# test for BIT fields
606
#create table t1bit (a1 bit(3), a2 bit(3));
607
#create table t2bit (b1 bit(3), b2 bit(3));
609
#insert into t1bit values (b'000', b'100');
610
#insert into t1bit values (b'001', b'101');
611
#insert into t1bit values (b'010', b'110');
613
#insert into t2bit values (b'001', b'101');
614
#insert into t2bit values (b'010', b'110');
615
#insert into t2bit values (b'110', b'111');
617
#set @@optimizer_switch=no_semijoin;
619
#explain extended select bin(a1), bin(a2)
621
#where (a1, a2) in (select b1, b2 from t2bit);
623
#select bin(a1), bin(a2)
625
#where (a1, a2) in (select b1, b2 from t2bit);
627
#drop table t1bit, t2bit;
629
## test mixture of BIT and BLOB
630
#create table t1bb (a1 bit(3), a2 blob(3));
631
#create table t2bb (b1 bit(3), b2 blob(3));
633
#insert into t1bb values (b'000', '100');
634
#insert into t1bb values (b'001', '101');
635
#insert into t1bb values (b'010', '110');
637
#insert into t2bb values (b'001', '101');
638
#insert into t2bb values (b'010', '110');
639
#insert into t2bb values (b'110', '111');
641
#explain extended select bin(a1), a2
643
#where (a1, a2) in (select b1, b2 from t2bb);
647
#where (a1, a2) in (select b1, b2 from t2bb);
649
#drop table t1bb, t2bb;
650
#drop table t1, t2, t3, t1i, t2i, t3i, columns;
651
604
drop table t1, t2, t3;
653
606
/******************************************************************************
656
609
set @@optimizer_switch=no_semijoin;
658
611
# Test that default values of Cached_item are not used for comparison
659
create table t1 (s1 int);
660
create table t2 (s2 int);
612
create table t1 (s1 int) ENGINE=MyISAM;
613
create table t2 (s2 int) ENGINE=MyISAM;
661
614
insert into t1 values (5),(1),(0);
662
615
insert into t2 values (0), (1);
663
616
select s2 from t2 where s2 in (select s1 from t1);
664
617
drop table t1, t2;
666
create table t1 (a int not null, b int not null);
667
create table t2 (c int not null, d int not null);
668
create table t3 (e int not null);
619
create table t1 (a int not null, b int not null) ENGINE=MyISAM;
620
create table t2 (c int not null, d int not null) ENGINE=MyISAM;
621
create table t3 (e int not null) ENGINE=MyISAM;
670
623
# the first outer row has no matching inner row
671
624
insert into t1 values (1,10);