~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/subselect_mat.test

  • Committer: Monty Taylor
  • Date: 2008-12-30 17:48:05 UTC
  • mfrom: (642.1.59 drizzle-clean-code)
  • mto: This revision was merged to the branch mainline in revision 755.
  • Revision ID: mordred@inaugust.com-20081230174805-luthhq80wufqg0cu
MergedĀ fromĀ Lee.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
drop table if exists t1, t2, t3, t1i, t2i, t3i;
8
8
--enable_warnings
9
9
 
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;
13
13
 
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');
28
28
 
29
29
# Indexed columns
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);
237
237
select ((a1,a2) IN (select * from t2 where b2 > '0')) IS NULL from t1;
238
238
 
239
239
/* GROUP BY clause */
240
 
create table columns (col int key);
 
240
create table columns (col int key) ENGINE=MyISAM;
241
241
insert into columns values (1), (2);
242
242
 
243
243
explain extended
268
268
set @blob_len = 16;
269
269
set @suffix_len = @blob_len - @prefix_len;
270
270
 
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;
274
274
 
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;
363
363
 
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;
367
367
 
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;
445
445
 
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;
449
449
 
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;
527
527
 
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;
531
531
 
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);
602
602
 
603
603
drop table t1_1025, t2_1025, t3_1025;
604
 
 
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));
608
 
#
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');
612
 
#
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');
616
 
#
617
 
#set @@optimizer_switch=no_semijoin;
618
 
#
619
 
#explain extended select bin(a1), bin(a2)
620
 
#from t1bit
621
 
#where (a1, a2) in (select b1, b2 from t2bit);
622
 
#
623
 
#select bin(a1), bin(a2)
624
 
#from t1bit
625
 
#where (a1, a2) in (select b1, b2 from t2bit);
626
 
#
627
 
#drop table t1bit, t2bit;
628
 
#
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));
632
 
#
633
 
#insert into t1bb values (b'000', '100');
634
 
#insert into t1bb values (b'001', '101');
635
 
#insert into t1bb values (b'010', '110');
636
 
#
637
 
#insert into t2bb values (b'001', '101');
638
 
#insert into t2bb values (b'010', '110');
639
 
#insert into t2bb values (b'110', '111');
640
 
#
641
 
#explain extended select bin(a1), a2
642
 
#from t1bb
643
 
#where (a1, a2) in (select b1, b2 from t2bb);
644
 
#
645
 
#select bin(a1), a2
646
 
#from t1bb
647
 
#where (a1, a2) in (select b1, b2 from t2bb);
648
 
#
649
 
#drop table t1bb, t2bb;
650
 
#drop table t1, t2, t3, t1i, t2i, t3i, columns;
651
604
drop table t1, t2, t3;
652
605
 
653
606
/******************************************************************************
656
609
set @@optimizer_switch=no_semijoin;
657
610
 
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;
665
618
 
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;
669
622
 
670
623
# the first outer row has no matching inner row
671
624
insert into t1 values (1,10);