~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/func_time.test

  • Committer: Jay Pipes
  • Date: 2009-01-28 18:37:38 UTC
  • mto: This revision was merged to the branch mainline in revision 817.
  • Revision ID: jpipes@serialcoder-20090128183738-f1injoijz8uvwys3
Fixes to existing func_time.test for bad datetimes passed to MONTH() and MONTHNAME() function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
22
22
select dayofmonth("1997-01-02"),dayofmonth(19970323);
23
23
select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
 
24
--error 1686 # No more bad dates!
24
25
select month("2001-02-00"),year("2001-01-01");
25
26
select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303);
26
27
select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322);
186
187
create table t1 (id int);
187
188
create table t2 (id int, date date);
188
189
insert into t1 values (1);
189
 
insert into t2 values (1, "0000-00-00");
 
190
insert into t2 values (1, NULL);
190
191
insert into t1 values (2);
191
192
insert into t2 values (2, "2000-01-01");
192
193
select monthname(date) from t1 inner join t2 on t1.id = t2.id;
198
199
 
199
200
CREATE TABLE t1 (updated text) ENGINE=MyISAM;
200
201
INSERT INTO t1 VALUES ('');
 
202
--error 1686 # "" is not a date!
201
203
SELECT month(updated) from t1;
202
204
--error 1686 # "" is not a date for pete's sake.
203
205
SELECT year(updated) from t1;
212
214
insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
213
215
select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;
214
216
select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;
 
217
--error 1686 # 0000-00-00 is not a damn date.
215
218
select month("0000-00-00"),month(d),month(dt),month(t),month(c) from t1;
216
219
select quarter("0000-00-00"),quarter(d),quarter(dt),quarter(t),quarter(c) from t1;
217
220
select week("0000-00-00"),week(d),week(dt),week(t),week(c) from t1;
439
442
# Bug #18501: monthname and NULLs
440
443
#
441
444
 
 
445
--error 1686 # Once again no bad dates allowed!
442
446
select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
443
447
       monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
444
448