~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/join_outer.test

Cleanup around SAFEMALLOC

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
CREATE TABLE t1 (
10
10
  grp int default NULL,
11
 
  a bigint default NULL,
 
11
  a bigint unsigned default NULL,
12
12
  c char(10) NOT NULL default ''
13
13
) ENGINE=MyISAM;
14
14
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
15
 
create table t2 (id int, a bigint not null, c char(10), d int, primary key (a));
 
15
create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a));
16
16
insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
17
17
 
18
18
select t1.*,t2.* from t1 JOIN t2 where t1.a=t2.a;
55
55
#
56
56
 
57
57
CREATE TABLE t1 (
58
 
 usr_id INT NOT NULL,
59
 
 uniq_id INT NOT NULL AUTO_INCREMENT,
60
 
        start_num INT NOT NULL DEFAULT 1,
61
 
        increment INT NOT NULL DEFAULT 1,
 
58
 usr_id INT unsigned NOT NULL,
 
59
 uniq_id INT unsigned NOT NULL AUTO_INCREMENT,
 
60
        start_num INT unsigned NOT NULL DEFAULT 1,
 
61
        increment INT unsigned NOT NULL DEFAULT 1,
62
62
 PRIMARY KEY (uniq_id),
63
63
 INDEX usr_uniq_idx (usr_id, uniq_id),
64
64
 INDEX uniq_usr_idx (uniq_id, usr_id)
65
65
);
66
66
CREATE TABLE t2 (
67
 
 id INT NOT NULL DEFAULT 0,
68
 
 usr2_id INT NOT NULL DEFAULT 0,
69
 
 max INT NOT NULL DEFAULT 0,
70
 
 c_amount INT NOT NULL DEFAULT 0,
71
 
 d_max INT NOT NULL DEFAULT 0,
72
 
 d_num INT NOT NULL DEFAULT 0,
73
 
 orig_time INT NOT NULL DEFAULT 0,
74
 
 c_time INT NOT NULL DEFAULT 0,
 
67
 id INT unsigned NOT NULL DEFAULT 0,
 
68
 usr2_id INT unsigned NOT NULL DEFAULT 0,
 
69
 max INT unsigned NOT NULL DEFAULT 0,
 
70
 c_amount INT unsigned NOT NULL DEFAULT 0,
 
71
 d_max INT unsigned NOT NULL DEFAULT 0,
 
72
 d_num INT unsigned NOT NULL DEFAULT 0,
 
73
 orig_time INT unsigned NOT NULL DEFAULT 0,
 
74
 c_time INT unsigned NOT NULL DEFAULT 0,
75
75
 active ENUM ("no","yes") NOT NULL,
76
76
 PRIMARY KEY (id,usr2_id),
77
77
 INDEX id_idx (id),
140
140
CREATE TABLE t2 (
141
141
  idAssignatura int DEFAULT '0' NOT NULL,
142
142
  Grup int DEFAULT '0' NOT NULL,
143
 
  Places int DEFAULT '0' NOT NULL,
 
143
  Places smallint DEFAULT '0' NOT NULL,
144
144
  PlacesOcupades int DEFAULT '0',
145
145
  PRIMARY KEY (idAssignatura,Grup)
146
146
);
177
177
  dni_pasaporte char(16) DEFAULT '' NOT NULL,
178
178
  idPla int DEFAULT '0' NOT NULL,
179
179
  cod_asig int DEFAULT '0' NOT NULL,
180
 
  any int DEFAULT '0' NOT NULL,
181
 
  quatrimestre int DEFAULT '0' NOT NULL,
 
180
  any smallint DEFAULT '0' NOT NULL,
 
181
  quatrimestre smallint DEFAULT '0' NOT NULL,
182
182
  estat char(1) DEFAULT 'M' NOT NULL,
183
183
  PRIMARY KEY (id),
184
184
  UNIQUE dni_pasaporte (dni_pasaporte,idPla),
215
215
#
216
216
 
217
217
CREATE TABLE t1 (
218
 
  id int NOT NULL auto_increment,
 
218
  id smallint unsigned NOT NULL auto_increment,
219
219
  name char(60) DEFAULT '' NOT NULL,
220
220
  PRIMARY KEY (id)
221
221
);
224
224
INSERT INTO t1 VALUES (3,'Thimble Smith');
225
225
 
226
226
CREATE TABLE t2 (
227
 
  id int NOT NULL auto_increment,
228
 
  owner int DEFAULT '0' NOT NULL,
 
227
  id smallint unsigned NOT NULL auto_increment,
 
228
  owner smallint unsigned DEFAULT '0' NOT NULL,
229
229
  name char(60),
230
230
  PRIMARY KEY (id)
231
231
);
374
374
CREATE TABLE t1 (
375
375
  id int,
376
376
  pid int,
377
 
  rep_del int,
 
377
  rep_del tinyint,
378
378
  KEY id (id),
379
379
  KEY pid (pid)
380
380
);
414
414
#
415
415
# Test problem with LEFT JOIN
416
416
 
417
 
create table t1 (fooID int auto_increment, primary key (fooID));
418
 
create table t2 (fooID int not null, barID int not null, primary key (fooID,barID));
 
417
create table t1 (fooID smallint unsigned auto_increment, primary key (fooID));
 
418
create table t2 (fooID smallint unsigned not null, barID smallint unsigned not null, primary key (fooID,barID));
419
419
insert into t1 (fooID) values (10),(20),(30);
420
420
insert into t2 values (10,1),(20,2),(30,3);
421
421
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
476
476
# Test for BUG#5088
477
477
 
478
478
create table t1 (
479
 
  match_id int not null auto_increment,
480
 
  home int default '0',
 
479
  match_id tinyint unsigned not null auto_increment,
 
480
  home tinyint unsigned default '0',
481
481
  unique key match_id (match_id),
482
482
  key match_id_2 (match_id)
483
483
);
485
485
insert into t1 values("1", "2");
486
486
 
487
487
create table t2 (
488
 
  player_id int default '0',
489
 
  match_1_h int default '0',
 
488
  player_id tinyint unsigned default '0',
 
489
  match_1_h tinyint unsigned default '0',
490
490
  key player_id (player_id)
491
491
);
492
492
 
539
539
 
540
540
CREATE TABLE t1 (
541
541
  ts_id bigint default NULL,
542
 
  inst_id int default NULL,
 
542
  inst_id tinyint default NULL,
543
543
  flag_name varchar(64) default NULL,
544
544
  flag_value text,
545
545
  UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
547
547
 
548
548
CREATE TABLE t2 (
549
549
  ts_id bigint default NULL,
550
 
  inst_id int default NULL,
 
550
  inst_id tinyint default NULL,
551
551
  flag_name varchar(64) default NULL,
552
552
  flag_value text,
553
553
  UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
571
571
DROP TABLE t1,t2;
572
572
 
573
573
CREATE TABLE t1 (
574
 
  id int NOT NULL auto_increment,
575
 
  text_id int default NULL,
 
574
  id int unsigned NOT NULL auto_increment,
 
575
  text_id int unsigned default NULL,
576
576
  PRIMARY KEY  (id)
577
577
);
578
578
 
669
669
#
670
670
# BUG#10162 - ON is merged with WHERE, left join is convered to a regular join
671
671
#
672
 
create table t1 (gid int not null, x int not null, y int not null, art int not null, primary key  (gid,x,y));
 
672
create table t1 (gid smallint unsigned not null, x int not null, y int not null, art int not null, primary key  (gid,x,y));
673
673
insert t1 values (1, -5, -8, 2), (1, 2, 2, 1), (1, 1, 1, 1);
674
 
create table t2 (gid int not null, x int not null, y int not null, id int not null, primary key  (gid,id,x,y), key id (id));
 
674
create table t2 (gid smallint unsigned not null, x int not null, y int not null, id int not null, primary key  (gid,id,x,y), key id (id));
675
675
insert t2 values (1, -5, -8, 1), (1, 1, 1, 1), (1, 2, 2, 1);
676
 
create table t3 ( set_id int not null, id int not null, name char(12) not null, primary key  (id,set_id));
 
676
create table t3 ( set_id smallint unsigned not null, id tinyint unsigned not null, name char(12) not null, primary key  (id,set_id));
677
677
insert t3 values (0, 1, 'a'), (1, 1, 'b'), (0, 2, 'c'), (1, 2, 'd'), (1, 3, 'e'), (1, 4, 'f'), (1, 5, 'g'), (1, 6, 'h');
678
678
explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y
679
679
left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8
760
760
761
761
 
762
762
CREATE TABLE t1 (
763
 
  f1 varchar(16) collate utf8_swedish_ci PRIMARY KEY,
764
 
  f2 varchar(16) collate utf8_swedish_ci
 
763
  f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
 
764
  f2 varchar(16) collate latin1_swedish_ci
765
765
);
766
766
CREATE TABLE t2 (
767
 
  f1 varchar(16) collate utf8_swedish_ci PRIMARY KEY,
768
 
  f3 varchar(16) collate utf8_swedish_ci
 
767
  f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
 
768
  f3 varchar(16) collate latin1_swedish_ci
769
769
);
770
770
 
771
771
INSERT INTO t1 VALUES ('bla','blah');