~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/null_key.test

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
create table t2 like t1;
32
32
insert into t2 select * from t1;
33
33
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));
34
 
# @TODO Should this be a MyISAM-specific test or not?
35
 
# Ignore "rows" in output -- inaccurate for InnoDB
36
 
--replace_column 9 X
37
34
explain select * from t1 where a is null and b = 2;
38
 
# Ignore "rows" in output -- inaccurate for InnoDB
39
 
--replace_column 9 X
40
35
explain select * from t1 where a is null and b = 2 and c=0;
41
 
# Ignore "rows" in output -- inaccurate for InnoDB
42
 
--replace_column 9 X
43
36
explain select * from t1 where a is null and b = 7 and c=0;
44
 
# Ignore "rows" in output -- inaccurate for InnoDB
45
 
--replace_column 9 X
46
37
explain select * from t1 where a=2 and b = 2;
47
 
# Ignore "rows" in output -- inaccurate for InnoDB
48
 
--replace_column 9 X
49
38
explain select * from t1 where a<=>b limit 2;
50
 
# Ignore "rows" in output -- inaccurate for InnoDB
51
 
--replace_column 9 X
52
39
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
53
 
# Ignore "rows" in output -- inaccurate for InnoDB
54
 
--replace_column 9 X
55
40
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
56
 
# Ignore "rows" in output -- inaccurate for InnoDB
57
 
--replace_column 9 X
58
41
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
59
 
# Ignore "rows" in output -- inaccurate for InnoDB
60
 
--replace_column 9 X
61
42
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
62
 
# Ignore "rows" in output -- inaccurate for InnoDB
63
 
--replace_column 9 X
64
43
explain select * from t1 where a > 1 and a < 3 limit 1;
65
 
# Ignore "rows" in output -- inaccurate for InnoDB
66
 
--replace_column 9 X
67
44
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
68
 
# Ignore "rows" in output -- inaccurate for InnoDB
69
 
--replace_column 9 X
70
45
explain select * from t1 where a > 8 and a < 9;
71
 
# Ignore "rows" in output -- inaccurate for InnoDB
72
 
--replace_column 9 X
73
46
explain select * from t1 where b like "6%";
74
47
select * from t1 where a is null;
75
48
select * from t1 where a is null and b = 7 and c=0;
84
57
# Test ref_or_null optimization
85
58
#
86
59
drop table t1;
87
 
# @TODO Bug in the following RENAME...changing it out for now.
88
 
# rename table t2 to t1;
89
 
drop table t2;
90
 
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
 
60
rename table t2 to t1;
91
61
alter table t1 modify b int null;
92
62
insert into t1 values (7,null), (8,null), (8,7);
93
63
explain select * from t1 where a = 7 and (b=7 or b is null);
98
68
select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
99
69
create table t2 (a int);
100
70
insert into t2 values (7),(8);
101
 
# Ignore "rows" in output -- inaccurate for InnoDB
102
 
--replace_column 9 X
103
71
explain select * from t2 straight_join t1 where t1.a=t2.a and b is null;
104
72
drop index b on t1;
105
 
# Ignore "rows" in output -- inaccurate for InnoDB
106
 
--replace_column 9 X
107
73
explain select * from t2,t1 where t1.a=t2.a and b is null;
108
74
select * from t2,t1 where t1.a=t2.a and b is null;
109
 
# Ignore "rows" in output -- inaccurate for InnoDB
110
 
--replace_column 9 X
111
75
explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
112
76
select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
113
 
# Ignore "rows" in output -- inaccurate for InnoDB
114
 
--replace_column 9 X
115
77
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
116
78
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
117
 
# Ignore "rows" in output -- inaccurate for InnoDB
118
 
--replace_column 9 X
119
79
explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
120
80
select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
121
81
insert into t2 values (null),(6);
122
82
delete from t1 where a=8;
123
 
# Ignore "rows" in output -- inaccurate for InnoDB
124
 
--replace_column 9 X
125
83
explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
126
 
# Ignore "rows" in output -- inaccurate for InnoDB
127
 
--replace_column 9 X
128
84
explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
129
85
select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
130
86
drop table t1,t2;
134
90
#
135
91
 
136
92
CREATE TABLE t1 (
137
 
  id int NOT NULL auto_increment,
138
 
  uniq_id int default NULL,
 
93
  id int(10) NOT NULL auto_increment,
 
94
  uniq_id int(10) default NULL,
139
95
  PRIMARY KEY  (id),
140
96
  UNIQUE KEY idx1 (uniq_id)
141
97
) ENGINE=MyISAM;
142
98
 
143
99
CREATE TABLE t2 (
144
 
  id int NOT NULL auto_increment,
145
 
  uniq_id int default NULL,
 
100
  id int(10) NOT NULL auto_increment,
 
101
  uniq_id int(10) default NULL,
146
102
  PRIMARY KEY  (id)
147
103
) ENGINE=MyISAM;
148
104
 
180
136
CREATE TABLE `t1` (
181
137
  `order_id` char(32) NOT NULL default '',
182
138
  `product_id` char(32) NOT NULL default '',
183
 
  `product_type` int NOT NULL default '0',
 
139
  `product_type` int(11) NOT NULL default '0',
184
140
  PRIMARY KEY  (`order_id`,`product_id`,`product_type`)
185
141
) ENGINE=MyISAM;
186
142
CREATE TABLE `t2` (
187
143
  `order_id` char(32) NOT NULL default '',
188
144
  `product_id` char(32) NOT NULL default '',
189
 
  `product_type` int NOT NULL default '0',
 
145
  `product_type` int(11) NOT NULL default '0',
190
146
  PRIMARY KEY  (`order_id`,`product_id`,`product_type`)
191
147
) ENGINE=MyISAM;
192
148
INSERT INTO t1 (order_id, product_id, product_type) VALUES
227
183
  index (id),
228
184
  index (id2)
229
185
);
230
 
--error 1048
231
186
insert into t1 values(null,null),(1,1);
232
187
select * from t1;
233
188
select * from t1 where id <=> null;
275
230
 
276
231
SELECT COUNT(*) FROM t3;
277
232
 
278
 
# Ignore the 9th column (rows in EXPLAIN output - inaccurate in InnoDB)
279
 
--replace_column 9 X
280
233
EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
281
234
                                             LEFT JOIN t3 ON t2.b=t3.b;
282
235
FLUSH STATUS ;
292
245
# BUG#34945 "ref_or_null queries that are null_rejecting and have a null value crash mysql"
293
246
294
247
CREATE TABLE t1 (
295
 
  a int default NULL,
296
 
  b int default NULL,
 
248
  a int(11) default NULL,
 
249
  b int(11) default NULL,
297
250
  KEY a (a,b)
298
251
);
299
252
INSERT INTO t1 VALUES (0,10),(0,11),(0,12);
300
253
 
301
254
CREATE TABLE t2 (
302
 
  a int default NULL,
303
 
  b int default NULL,
 
255
  a int(11) default NULL,
 
256
  b int(11) default NULL,
304
257
  KEY a (a)
305
258
);
306
259
INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12);