~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/join.test

  • Committer: Brian Aker
  • Date: 2009-01-23 05:05:23 UTC
  • mto: (779.3.3 devel)
  • mto: This revision was merged to the branch mainline in revision 811.
  • Revision ID: brian@tangent.org-20090123050523-fkyc1gmddjnax173
Solaris build error fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
#
63
63
 
64
64
CREATE TABLE t1 (
65
 
  id int(11) NOT NULL auto_increment,
 
65
  id int NOT NULL auto_increment,
66
66
  token varchar(100) DEFAULT '' NOT NULL,
67
 
  count int(11) DEFAULT '0' NOT NULL,
68
 
  qty int(11),
 
67
  count int DEFAULT '0' NOT NULL,
 
68
  qty int,
69
69
  phone char(1) DEFAULT '' NOT NULL,
70
70
  timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
71
71
  PRIMARY KEY (id),
87
87
INSERT INTO t1 VALUES (29,'a71250b7ed780f6ef3185bfffe027983',4,17700,'b','1999-12-27 09:45:05');
88
88
 
89
89
CREATE TABLE t2 (
90
 
  id int(11) NOT NULL auto_increment,
91
 
  category int(11) DEFAULT '0' NOT NULL,
92
 
  county int(11) DEFAULT '0' NOT NULL,
93
 
  state int(11) DEFAULT '0' NOT NULL,
94
 
  phones int(11) DEFAULT '0' NOT NULL,
95
 
  nophones int(11) DEFAULT '0' NOT NULL,
 
90
  id int NOT NULL auto_increment,
 
91
  category int DEFAULT '0' NOT NULL,
 
92
  county int DEFAULT '0' NOT NULL,
 
93
  state int DEFAULT '0' NOT NULL,
 
94
  phones int DEFAULT '0' NOT NULL,
 
95
  nophones int DEFAULT '0' NOT NULL,
96
96
  PRIMARY KEY (id),
97
97
  KEY category (category,county,state)
98
98
);
127
127
#
128
128
 
129
129
CREATE TABLE t1 (
130
 
  a int(11) NOT NULL,
131
 
  b int(11) NOT NULL,
 
130
  a int NOT NULL,
 
131
  b int NOT NULL,
132
132
  PRIMARY KEY  (a,b)
133
133
) ENGINE=MyISAM;
134
134
 
135
135
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3);
136
136
 
137
137
CREATE TABLE t2 (
138
 
  a int(11) default NULL
 
138
  a int default NULL
139
139
) ENGINE=MyISAM;
140
140
INSERT INTO t2 VALUES (2),(3);
141
141
SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3;
175
175
  Language_ID char(3) NOT NULL default '',
176
176
  Document_ID char(50) NOT NULL default '',
177
177
  CanRead char(1) default NULL,
178
 
  Customer_ID int(11) NOT NULL default '0',
 
178
  Customer_ID int NOT NULL default '0',
179
179
  PRIMARY KEY  (Contractor_ID,Language_ID,Document_ID,Customer_ID)
180
180
);
181
181
 
232
232
#
233
233
 
234
234
CREATE TABLE t1 (
235
 
  t1_id int(11) default NULL,
236
 
  t2_id int(11) default NULL,
 
235
  t1_id int default NULL,
 
236
  t2_id int default NULL,
237
237
  type enum('Cost','Percent') default NULL,
238
238
  cost_unit enum('Cost','Unit') default NULL,
239
239
  min_value double default NULL,
240
240
  max_value double default NULL,
241
 
  t3_id int(11) default NULL,
242
 
  item_id int(11) default NULL
 
241
  t3_id int default NULL,
 
242
  item_id int default NULL
243
243
) ENGINE=MyISAM;
244
244
INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1);
245
245
CREATE TABLE t2 (
246
 
  id int(10) unsigned NOT NULL auto_increment,
 
246
  id int NOT NULL auto_increment,
247
247
  name varchar(255) default NULL,
248
248
  PRIMARY KEY  (id)
249
249
) ENGINE=MyISAM;
506
506
-- error 1052
507
507
select * from (t1 natural join t2) natural join (t3 join (t4 natural join t5) on (b < z));
508
508
 
509
 
#
510
 
# Bug #17523 natural join and information_schema
511
 
#
512
 
# We mask out the Privileges column because it differs with embedded server
513
 
--replace_column 32 #
514
 
query_vertical 
515
 
select * from information_schema.statistics join information_schema.columns
516
 
              using(table_name,column_name) where table_name='user';
517
 
 
518
509
drop table t1;
519
510
drop table t2;
520
511
drop table t3;
602
593
insert into t3 select * from t2 where a < 800;
603
594
 
604
595
# The order of tables must be t2,t3:
605
 
explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
 
596
#explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
606
597
 
607
598
drop table t1, t2, t3;
608
599