~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/r/join.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE noticed after reading const tables
70
70
drop table t1,t2;
71
71
CREATE TABLE t1 (
72
 
id int NOT NULL auto_increment,
 
72
id int(11) NOT NULL auto_increment,
73
73
token varchar(100) DEFAULT '' NOT NULL,
74
 
count int DEFAULT '0' NOT NULL,
75
 
qty int,
 
74
count int(11) DEFAULT '0' NOT NULL,
 
75
qty int(11),
76
76
phone char(1) DEFAULT '' NOT NULL,
77
 
timestamp datetime,
 
77
timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
78
78
PRIMARY KEY (id),
79
79
KEY token (token(15)),
80
80
KEY timestamp (timestamp),
92
92
INSERT INTO t1 VALUES (28,'a71250b7ed780f6ef3185bfffe027983',3,5400,'y','1999-12-27 09:44:36');
93
93
INSERT INTO t1 VALUES (29,'a71250b7ed780f6ef3185bfffe027983',4,17700,'b','1999-12-27 09:45:05');
94
94
CREATE TABLE t2 (
95
 
id int NOT NULL auto_increment,
96
 
category int DEFAULT '0' NOT NULL,
97
 
county int DEFAULT '0' NOT NULL,
98
 
state int DEFAULT '0' NOT NULL,
99
 
phones int DEFAULT '0' NOT NULL,
100
 
nophones int DEFAULT '0' NOT NULL,
 
95
id int(11) NOT NULL auto_increment,
 
96
category int(11) DEFAULT '0' NOT NULL,
 
97
county int(11) DEFAULT '0' NOT NULL,
 
98
state int(11) DEFAULT '0' NOT NULL,
 
99
phones int(11) DEFAULT '0' NOT NULL,
 
100
nophones int(11) DEFAULT '0' NOT NULL,
101
101
PRIMARY KEY (id),
102
102
KEY category (category,county,state)
103
103
);
126
126
1
127
127
2
128
128
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
129
 
ERROR HY000: Too many tables; Drizzle can only use XX tables in a join
 
129
ERROR HY000: Too many tables; MySQL can only use XX tables in a join
130
130
select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
131
131
a
132
132
1
133
133
2
134
134
select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
135
 
ERROR HY000: Too many tables; Drizzle can only use XX tables in a join
 
135
ERROR HY000: Too many tables; MySQL can only use XX tables in a join
136
136
drop table t1;
137
 
CREATE TEMPORARY TABLE t1 (
138
 
a int NOT NULL,
139
 
b int NOT NULL,
 
137
CREATE TABLE t1 (
 
138
a int(11) NOT NULL,
 
139
b int(11) NOT NULL,
140
140
PRIMARY KEY  (a,b)
141
141
) ENGINE=MyISAM;
142
142
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3);
143
 
CREATE TEMPORARY TABLE t2 (
144
 
a int default NULL
 
143
CREATE TABLE t2 (
 
144
a int(11) default NULL
145
145
) ENGINE=MyISAM;
146
146
INSERT INTO t2 VALUES (2),(3);
147
147
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;
148
148
a       a       b
149
149
2       2       3
150
150
DROP TABLE t1, t2;
151
 
CREATE TABLE t1 (d DATE);
152
 
CREATE TABLE t2 (d DATE);
153
 
INSERT INTO t1 (d) VALUES ('2001-08-01'),(NULL);
 
151
CREATE TABLE t1 (d DATE NOT NULL);
 
152
CREATE TABLE t2 (d DATE NOT NULL);
 
153
INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
154
154
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
155
155
d
156
156
2001-08-01
157
 
NULL
 
157
0000-00-00
158
158
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE d IS NULL;
159
159
d
160
 
NULL
 
160
0000-00-00
161
161
SELECT * from t1 WHERE t1.d IS NULL;
162
162
d
163
 
NULL
 
163
0000-00-00
164
164
SELECT * FROM t1 WHERE 1/0 IS NULL;
165
165
d
166
166
2001-08-01
167
 
NULL
168
 
Warnings:
169
 
Error   1365    Division by 0
170
 
Error   1365    Division by 0
171
 
Error   1365    Division by 0
 
167
0000-00-00
172
168
DROP TABLE t1,t2;
173
169
CREATE TABLE t1 (
174
170
Document_ID varchar(50) NOT NULL default '',
186
182
Language_ID char(3) NOT NULL default '',
187
183
Document_ID char(50) NOT NULL default '',
188
184
CanRead char(1) default NULL,
189
 
Customer_ID int NOT NULL default '0',
 
185
Customer_ID int(11) NOT NULL default '0',
190
186
PRIMARY KEY  (Contractor_ID,Language_ID,Document_ID,Customer_ID)
191
187
);
192
188
INSERT INTO t2 VALUES ('5','ger','xep80','1',999999),('1','ger','xep80','1',999999);
240
236
COUNT(t1.Title)
241
237
1
242
238
drop table t1,t2,t3;
243
 
CREATE TEMPORARY TABLE t1 (
244
 
t1_id int default NULL,
245
 
t2_id int default NULL,
 
239
CREATE TABLE t1 (
 
240
t1_id int(11) default NULL,
 
241
t2_id int(11) default NULL,
246
242
type enum('Cost','Percent') default NULL,
247
243
cost_unit enum('Cost','Unit') default NULL,
248
244
min_value double default NULL,
249
245
max_value double default NULL,
250
 
t3_id int default NULL,
251
 
item_id int default NULL
 
246
t3_id int(11) default NULL,
 
247
item_id int(11) default NULL
252
248
) ENGINE=MyISAM;
253
249
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);
254
 
CREATE TEMPORARY TABLE t2 (
255
 
id int NOT NULL auto_increment,
 
250
CREATE TABLE t2 (
 
251
id int(10) unsigned NOT NULL auto_increment,
256
252
name varchar(255) default NULL,
257
253
PRIMARY KEY  (id)
258
254
) ENGINE=MyISAM;
262
258
22      1       Percent Cost    100     -1      6       291     1       s1
263
259
23      1       Percent Cost    100     -1      21      291     1       s1
264
260
drop table t1,t2;
265
 
CREATE TEMPORARY TABLE t1 (
 
261
CREATE TABLE t1 (
266
262
siteid varchar(25) NOT NULL default '',
267
263
emp_id varchar(30) NOT NULL default '',
268
264
rate_code varchar(10) default NULL,
270
266
KEY siteid (siteid)
271
267
) ENGINE=MyISAM;
272
268
INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust');
273
 
CREATE TEMPORARY TABLE t2 (
 
269
CREATE TABLE t2 (
274
270
siteid varchar(25) NOT NULL default '',
275
271
rate_code varchar(10) NOT NULL default '',
276
272
base_rate float NOT NULL default '0',
699
695
ERROR 23000: Column 'c' in from clause is ambiguous
700
696
select * from (t1 natural join t2) natural join (t3 join (t4 natural join t5) on (b < z));
701
697
ERROR 23000: Column 'c' in from clause is ambiguous
 
698
select * from information_schema.statistics join information_schema.columns
 
699
using(table_name,column_name) where table_name='user';
 
700
TABLE_NAME      user
 
701
COLUMN_NAME     Host
 
702
TABLE_CATALOG   NULL
 
703
TABLE_SCHEMA    mysql
 
704
NON_UNIQUE      0
 
705
INDEX_SCHEMA    mysql
 
706
INDEX_NAME      PRIMARY
 
707
SEQ_IN_INDEX    1
 
708
COLLATION       A
 
709
CARDINALITY     NULL
 
710
SUB_PART        NULL
 
711
PACKED  NULL
 
712
NULLABLE        
 
713
INDEX_TYPE      BTREE
 
714
COMMENT 
 
715
INDEX_COMMENT   
 
716
TABLE_CATALOG   NULL
 
717
TABLE_SCHEMA    mysql
 
718
ORDINAL_POSITION        1
 
719
COLUMN_DEFAULT  NULL
 
720
IS_NULLABLE     NO
 
721
DATA_TYPE       char
 
722
CHARACTER_MAXIMUM_LENGTH        60
 
723
CHARACTER_OCTET_LENGTH  240
 
724
NUMERIC_PRECISION       NULL
 
725
NUMERIC_SCALE   NULL
 
726
CHARACTER_SET_NAME      utf8
 
727
COLLATION_NAME  utf8_bin
 
728
COLUMN_TYPE     char(60)
 
729
COLUMN_KEY      PRI
 
730
EXTRA   
 
731
PRIVILEGES      #
 
732
COLUMN_COMMENT  
 
733
STORAGE Default
 
734
FORMAT  Default
 
735
TABLE_NAME      user
 
736
COLUMN_NAME     User
 
737
TABLE_CATALOG   NULL
 
738
TABLE_SCHEMA    mysql
 
739
NON_UNIQUE      0
 
740
INDEX_SCHEMA    mysql
 
741
INDEX_NAME      PRIMARY
 
742
SEQ_IN_INDEX    2
 
743
COLLATION       A
 
744
CARDINALITY     3
 
745
SUB_PART        NULL
 
746
PACKED  NULL
 
747
NULLABLE        
 
748
INDEX_TYPE      BTREE
 
749
COMMENT 
 
750
INDEX_COMMENT   
 
751
TABLE_CATALOG   NULL
 
752
TABLE_SCHEMA    mysql
 
753
ORDINAL_POSITION        2
 
754
COLUMN_DEFAULT  NULL
 
755
IS_NULLABLE     NO
 
756
DATA_TYPE       char
 
757
CHARACTER_MAXIMUM_LENGTH        16
 
758
CHARACTER_OCTET_LENGTH  64
 
759
NUMERIC_PRECISION       NULL
 
760
NUMERIC_SCALE   NULL
 
761
CHARACTER_SET_NAME      utf8
 
762
COLLATION_NAME  utf8_bin
 
763
COLUMN_TYPE     char(16)
 
764
COLUMN_KEY      PRI
 
765
EXTRA   
 
766
PRIVILEGES      #
 
767
COLUMN_COMMENT  
 
768
STORAGE Default
 
769
FORMAT  Default
702
770
drop table t1;
703
771
drop table t2;
704
772
drop table t3;
768
836
We expect rnd_next=5, and read_key must be 0 because of short-cutting:
769
837
show status like 'Handler_read%';
770
838
Variable_name   Value
771
 
Handler_read_first      1
772
 
Handler_read_key        2
 
839
Handler_read_first      0
 
840
Handler_read_key        0
773
841
Handler_read_next       0
774
842
Handler_read_prev       0
775
843
Handler_read_rnd        0
782
850
insert into t2 
783
851
select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C;
784
852
insert into t3 select * from t2 where a < 800;
 
853
explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
 
854
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
855
1       SIMPLE  t2      ALL     a,b     NULL    NULL    NULL    1000    Using where
 
856
1       SIMPLE  t3      ref     b       b       5       test.t2.b       1       
785
857
drop table t1, t2, t3;
786
858
create table t1 (a int);
787
859
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
792
864
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    10      
793
865
show status like '%cost%';
794
866
Variable_name   Value
795
 
Last_query_cost 2.999000
 
867
Last_query_cost 4.016090
796
868
select 'The cost of accessing t1 (dont care if it changes' '^';
797
869
The cost of accessing t1 (dont care if it changes
798
870
The cost of accessing t1 (dont care if it changes^
806
878
1       SIMPLE  B       eq_ref  PRIMARY PRIMARY 4       test.A.b        1       
807
879
show status like '%cost%';
808
880
Variable_name   Value
809
 
Last_query_cost 22.999000
 
881
Last_query_cost 24.016090
810
882
select '^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error' Z;
811
883
Z
812
884
^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error