~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/null_key.result

  • Committer: Brian Aker
  • Date: 2008-12-23 07:19:26 UTC
  • Revision ID: brian@tangent.org-20081223071926-69z2ugpftfz1lfnm
Remove dead variables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1,t2;
2
 
create temporary table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
 
2
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
3
3
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
4
4
explain select * from t1 where a is null;
5
5
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
21
21
1       SIMPLE  t1      range   a,b     a       9       NULL    3       Using where; Using index
22
22
explain select * from t1 where (a is null or a = 7) and b=7;
23
23
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
24
 
1       SIMPLE  t1      ref_or_null     a,b     a       9       const,const     2       Using where; Using index
 
24
1       SIMPLE  t1      ref_or_null     a,b     a       9       const,const     2       Using index
25
25
explain select * from t1 where (a is null or a = 7) and b=7 order by a;
26
26
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
27
 
1       SIMPLE  t1      ref_or_null     a,b     a       9       const,const     2       Using where; Using index; Using filesort
 
27
1       SIMPLE  t1      ref_or_null     a,b     a       9       const,const     2       Using index; Using filesort
28
28
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
29
29
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
30
30
1       SIMPLE  t1      ref     a,b     a       5       const   3       Using where; Using index
72
72
select * from t1 where a > 8 and a < 9;
73
73
a       b
74
74
create table t2 like t1;
75
 
ERROR HY000: Can't create table 'test.t2' (errno: 138)
76
 
create temporary table t2 like t1;
77
 
show create table t2;
78
 
Table   Create Table
79
 
t2      CREATE TEMPORARY TABLE `t2` (
80
 
  `a` INT DEFAULT NULL,
81
 
  `b` INT NOT NULL,
82
 
  UNIQUE KEY `a` (`a`,`b`),
83
 
  KEY `b` (`b`)
84
 
) ENGINE=MyISAM COLLATE = utf8_general_ci
85
75
insert into t2 select * from t1;
86
 
alter table t1 modify b blob not null, add c int DEFAULT 42 not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
 
76
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
87
77
explain select * from t1 where a is null and b = 2;
88
78
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
89
79
1       SIMPLE  t1      ref     a,b     a       5       const   X       Using where
125
115
1       SIMPLE  t1      range   b       b       12      NULL    X       Using where
126
116
select * from t1 where a is null;
127
117
a       b       c
128
 
NULL    7       42
129
 
NULL    9       42
130
 
NULL    9       42
 
118
NULL    7       0
 
119
NULL    9       0
 
120
NULL    9       0
131
121
select * from t1 where a is null and b = 7 and c=0;
132
122
a       b       c
 
123
NULL    7       0
133
124
select * from t1 where a<=>b limit 2;
134
125
a       b       c
135
 
1       1       42
136
 
2       2       42
 
126
1       1       0
 
127
2       2       0
137
128
select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
138
129
a       b       c
139
 
1       1       42
140
 
2       2       42
 
130
1       1       0
 
131
2       2       0
141
132
select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
142
133
a       b       c
143
 
NULL    9       42
144
 
NULL    9       42
 
134
NULL    9       0
 
135
NULL    9       0
145
136
select * from t1 where (a is null or a = 7) and b=7 and c=0;
146
137
a       b       c
 
138
7       7       0
 
139
NULL    7       0
147
140
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
148
141
a       b       c
149
 
NULL    7       42
150
 
NULL    9       42
151
 
NULL    9       42
 
142
NULL    7       0
 
143
NULL    9       0
 
144
NULL    9       0
152
145
select * from t1 where b like "6%";
153
146
a       b       c
154
 
6       6       42
 
147
6       6       0
155
148
drop table t1;
156
149
drop table t2;
157
 
create temporary table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
 
150
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
158
151
alter table t1 modify b int null;
159
152
insert into t1 values (7,null), (8,null), (8,7);
160
153
explain select * from t1 where a = 7 and (b=7 or b is null);
161
154
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
162
 
1       SIMPLE  t1      ref_or_null     a,b     a       10      const,const     2       Using where; Using index
 
155
1       SIMPLE  t1      ref_or_null     a,b     a       10      const,const     2       Using index
163
156
select * from t1 where a = 7 and (b=7 or b is null);
164
157
a       b
165
158
7       NULL
171
164
7       NULL
172
165
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
173
166
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
174
 
1       SIMPLE  t1      ref_or_null     a       a       5       const   2       Using where; Using index
 
167
1       SIMPLE  t1      ref_or_null     a       a       5       const   2       Using index
175
168
select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
176
169
a       b
177
170
7       NULL
193
186
explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
194
187
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
195
188
1       SIMPLE  t2      ALL     NULL    NULL    NULL    NULL    X       
196
 
1       SIMPLE  t1      ref_or_null     a       a       10      test.t2.a,const X       Using where; Using index
 
189
1       SIMPLE  t1      ref_or_null     a       a       10      test.t2.a,const X       Using index
197
190
select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
198
191
a       a       b
199
192
7       7       NULL
202
195
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
203
196
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
204
197
1       SIMPLE  t2      ALL     NULL    NULL    NULL    NULL    X       
205
 
1       SIMPLE  t1      ref_or_null     a       a       10      test.t2.a,const X       Using where; Using index
 
198
1       SIMPLE  t1      ref_or_null     a       a       10      test.t2.a,const X       Using index
206
199
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
207
200
a       a       b
208
201
8       8       7
229
222
a       a       b
230
223
7       7       NULL
231
224
drop table t1,t2;
232
 
CREATE TEMPORARY TABLE t1 (
 
225
CREATE TABLE t1 (
233
226
id int NOT NULL auto_increment,
234
227
uniq_id int default NULL,
235
228
PRIMARY KEY  (id),
236
229
UNIQUE KEY idx1 (uniq_id)
237
230
) ENGINE=MyISAM;
238
 
CREATE TEMPORARY TABLE t2 (
 
231
CREATE TABLE t2 (
239
232
id int NOT NULL auto_increment,
240
233
uniq_id int default NULL,
241
234
PRIMARY KEY  (id)
281
274
7       3
282
275
8       4
283
276
DROP table t1,t2;
284
 
CREATE TEMPORARY TABLE `t1` (
 
277
CREATE TABLE `t1` (
285
278
`order_id` char(32) NOT NULL default '',
286
279
`product_id` char(32) NOT NULL default '',
287
280
`product_type` int NOT NULL default '0',
288
281
PRIMARY KEY  (`order_id`,`product_id`,`product_type`)
289
282
) ENGINE=MyISAM;
290
 
CREATE TEMPORARY TABLE `t2` (
 
283
CREATE TABLE `t2` (
291
284
`order_id` char(32) NOT NULL default '',
292
285
`product_id` char(32) NOT NULL default '',
293
286
`product_type` int NOT NULL default '0',