~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/null_key.result

  • Committer: Brian Aker
  • Date: 2009-10-15 00:22:33 UTC
  • mto: (1183.1.11 merge)
  • mto: This revision was merged to the branch mainline in revision 1198.
  • Revision ID: brian@gaz-20091015002233-fa4ao2mbc67wls91
First pass of information engine. OMG, ponies... is it so much easier to
deal with creating and engine.

The list table iterator though... its ass, needs to go. We should also
abstract out share. Very few engines need a custom one. Just say'in

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
150
create temporary table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
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