~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-07-05 18:10:38 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: monty@inaugust.com-20080705181038-0ih0nnamu5qrut0y
Fixed prototypes. Cleaned define a little bit.

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
77
timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
78
78
PRIMARY KEY (id),
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
);
135
135
ERROR HY000: Too many tables; MySQL can only use XX tables in a join
136
136
drop table t1;
137
137
CREATE TABLE t1 (
138
 
a int NOT NULL,
139
 
b int NOT NULL,
 
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
143
CREATE TABLE t2 (
144
 
a int default NULL
 
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;
165
165
d
166
166
2001-08-01
167
167
0000-00-00
168
 
Warnings:
169
 
Error   1365    Division by 0
170
 
Error   1365    Division by 0
171
 
Error   1365    Division by 0
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);
241
237
1
242
238
drop table t1,t2,t3;
243
239
CREATE TABLE t1 (
244
 
t1_id int default NULL,
245
 
t2_id int default NULL,
 
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
250
CREATE TABLE t2 (
255
 
id int NOT NULL auto_increment,
 
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;
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     0
 
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