~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/func_date_add.result

  • Committer: Monty Taylor
  • Date: 2008-10-14 16:33:44 UTC
  • mfrom: (512 drizzle)
  • mto: (511.1.5 codestyle)
  • mto: This revision was merged to the branch mainline in revision 515.
  • Revision ID: monty@inaugust.com-20081014163344-9xprk712n9hmbrzr
MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1;
2
2
CREATE TABLE t1 (
3
 
visitor_id int(10) unsigned DEFAULT '0' NOT NULL,
4
 
group_id int(10) unsigned DEFAULT '0' NOT NULL,
5
 
hits int(10) unsigned DEFAULT '0' NOT NULL,
6
 
sessions int(10) unsigned DEFAULT '0' NOT NULL,
 
3
visitor_id int DEFAULT '0' NOT NULL,
 
4
group_id int DEFAULT '0' NOT NULL,
 
5
hits int DEFAULT '0' NOT NULL,
 
6
sessions int DEFAULT '0' NOT NULL,
7
7
ts timestamp,
8
8
PRIMARY KEY (visitor_id,group_id)
9
9
)/*! engine=MyISAM */;
45
45
465931136       2000-03-18 16:09:53
46
46
1092858576      2000-03-19 01:34:45
47
47
drop table t1;
48
 
set sql_mode='traditional';
49
48
create table t1 (d date);
50
49
insert into t1 (d) select date_sub('2000-01-01', INTERVAL 2001 YEAR);
51
50
ERROR 22008: Datetime function: datetime field overflow
53
52
ERROR 22008: Datetime function: datetime field overflow
54
53
insert into t1 values (date_add(NULL, INTERVAL 1 DAY));
55
54
insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
56
 
set sql_mode='';
57
55
insert into t1 (d) select date_sub('2000-01-01', INTERVAL 2001 YEAR);
58
 
Warnings:
59
 
Warning 1441    Datetime function: datetime field overflow
 
56
ERROR 22008: Datetime function: datetime field overflow
60
57
insert into t1 (d) select date_add('2000-01-01',interval 8000 year);
61
 
Warnings:
62
 
Warning 1441    Datetime function: datetime field overflow
 
58
ERROR 22008: Datetime function: datetime field overflow
63
59
insert into t1 values (date_add(NULL, INTERVAL 1 DAY));
64
60
insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
65
61
select * from t1;
68
64
NULL
69
65
NULL
70
66
NULL
71
 
NULL
72
 
NULL
73
67
drop table t1;
74
68
End of 4.1 tests
75
69
SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY;
87
81
create table t1 (a int, b varchar(10));
88
82
insert into t1 values (1, '2001-01-01'),(2, '2002-02-02');
89
83
select '2007-01-01' + interval a day from t1;
90
 
'2007-01-01' + interval a day
 
84
'2007-01-01' + interval a day 
91
85
2007-01-02
92
86
2007-01-03
93
87
select b + interval a day from t1;
94
 
b + interval a day
 
88
b + interval a day 
95
89
2001-01-02
96
90
2002-02-04
97
91
drop table t1;