~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/null_key.test

  • Committer: Monty Taylor
  • Date: 2009-03-03 07:39:39 UTC
  • mto: This revision was merged to the branch mainline in revision 910.
  • Revision ID: mordred@inaugust.com-20090303073939-rfswfdo68klfcp1o
Updated comment version indicators to handle drizzle versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
drop table if exists t1,t2;
6
6
--enable_warnings
7
7
 
8
 
create temporary table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
 
8
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
9
9
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);
10
10
explain select * from t1 where a is null;
11
11
explain select * from t1 where a is null and b = 2;
28
28
select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
29
29
select * from t1 where a > 1 and a < 3 limit 1;
30
30
select * from t1 where a > 8 and a < 9;
31
 
--error ER_CANT_CREATE_TABLE
32
31
create table t2 like t1;
33
 
create temporary table t2 like t1;
34
 
show create table t2;
35
32
insert into t2 select * from t1;
36
 
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));
 
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));
37
34
# @TODO Should this be a MyISAM-specific test or not?
38
35
# Ignore "rows" in output -- inaccurate for InnoDB
39
36
--replace_column 9 X
90
87
# @TODO Bug in the following RENAME...changing it out for now.
91
88
# rename table t2 to t1;
92
89
drop table t2;
93
 
create temporary table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
 
90
create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
94
91
alter table t1 modify b int null;
95
92
insert into t1 values (7,null), (8,null), (8,7);
96
93
explain select * from t1 where a = 7 and (b=7 or b is null);
136
133
# The following failed for Matt Loschert
137
134
#
138
135
 
139
 
CREATE TEMPORARY TABLE t1 (
 
136
CREATE TABLE t1 (
140
137
  id int NOT NULL auto_increment,
141
138
  uniq_id int default NULL,
142
139
  PRIMARY KEY  (id),
143
140
  UNIQUE KEY idx1 (uniq_id)
144
141
) ENGINE=MyISAM;
145
142
 
146
 
CREATE TEMPORARY TABLE t2 (
 
143
CREATE TABLE t2 (
147
144
  id int NOT NULL auto_increment,
148
145
  uniq_id int default NULL,
149
146
  PRIMARY KEY  (id)
180
177
# This crashed MySQL 3.23.47
181
178
#
182
179
 
183
 
CREATE TEMPORARY TABLE `t1` (
 
180
CREATE TABLE `t1` (
184
181
  `order_id` char(32) NOT NULL default '',
185
182
  `product_id` char(32) NOT NULL default '',
186
183
  `product_type` int NOT NULL default '0',
187
184
  PRIMARY KEY  (`order_id`,`product_id`,`product_type`)
188
185
) ENGINE=MyISAM;
189
 
CREATE TEMPORARY TABLE `t2` (
 
186
CREATE TABLE `t2` (
190
187
  `order_id` char(32) NOT NULL default '',
191
188
  `product_id` char(32) NOT NULL default '',
192
189
  `product_type` int NOT NULL default '0',
230
227
  index (id),
231
228
  index (id2)
232
229
);
233
 
--error ER_BAD_NULL_ERROR
 
230
--error 1048
234
231
insert into t1 values(null,null),(1,1);
235
232
select * from t1;
236
233
select * from t1 where id <=> null;