~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/null_key.test

Replace MAX_(DATE|TIME).*_WIDTH defines in definitions.h with real (and correct) static const members to Temporal types.

This fixes the buffer overflow in https://bugs.launchpad.net/drizzle/+bug/373468

It also removes a handwritten snprintf in field/datetime.cc
However... this caused us to have to change Temporal to have a way to not
"convert" the int64_t value (so 20090101 becomes 20090101000000 etc) as it
has already been converted and we just want the Temporal type to do the
to_string conversion.

This still causes a failure in 'metadata' test due to size of timestamp type. I need feedback from Jay on when the usecond code comes into play to know the correct fix for this.

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 1005
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
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?
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',