~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/tokudb/mysql-test/tokudb/r/type_date.result

  • Committer: Package Import Robot
  • Author(s): James Page, Otto Kekäläinen
  • Date: 2014-02-17 16:51:52 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140217165152-k315d3175g865kkx
Tags: 5.5.35-1
[ Otto Kekäläinen ]
* New upstream release, fixing the following security issues:
  - Buffer overflow in client/mysql.cc (Closes: #737597).
    - CVE-2014-0001
  - http://www.oracle.com/technetwork/topics/security/cpujan2014-1972949.html
    - CVE-2013-5891
    - CVE-2013-5908
    - CVE-2014-0386
    - CVE-2014-0393
    - CVE-2014-0401
    - CVE-2014-0402
    - CVE-2014-0412
    - CVE-2014-0420
    - CVE-2014-0437
* Upstream https://mariadb.atlassian.net/browse/MDEV-4902
  fixes compatibility with Bison 3.0 (Closes: #733002)
* Updated Russian debconf translation (Closes: #734426)
* Updated Japanese debconf translation (Closes: #735284)
* Updated French debconf translation (Closes: #736480)
* Renamed SONAME properly (Closes: #732967)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
SET DEFAULT_STORAGE_ENGINE='tokudb';
 
2
drop table if exists t1,t2,t3;
 
3
create table t1 (a char(16), b date, c datetime);
 
4
insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01';
 
5
select * from t1 where c = '2000-01-01';
 
6
a       b       c
 
7
test 2000-01-01 2000-01-01      2000-01-01 00:00:00
 
8
select * from t1 where b = '2000-01-01';
 
9
a       b       c
 
10
test 2000-01-01 2000-01-01      2000-01-01 00:00:00
 
11
drop table t1;
 
12
CREATE TABLE t1 (name char(6),cdate date);
 
13
INSERT INTO t1 VALUES ('name1','1998-01-01');
 
14
INSERT INTO t1 VALUES ('name2','1998-01-01');
 
15
INSERT INTO t1 VALUES ('name1','1998-01-02');
 
16
INSERT INTO t1 VALUES ('name2','1998-01-02');
 
17
CREATE TABLE t2 (cdate date, note char(6));
 
18
INSERT INTO t2 VALUES ('1998-01-01','note01');
 
19
INSERT INTO t2 VALUES ('1998-01-02','note02');
 
20
select name,t1.cdate,note from t1,t2 where t1.cdate=t2.cdate and t1.cdate='1998-01-01';
 
21
name    cdate   note
 
22
name1   1998-01-01      note01
 
23
name2   1998-01-01      note01
 
24
drop table t1,t2;
 
25
CREATE TABLE t1 ( datum DATE );
 
26
INSERT INTO t1 VALUES ( "2000-1-1" );
 
27
INSERT INTO t1 VALUES ( "2000-1-2" );
 
28
INSERT INTO t1 VALUES ( "2000-1-3" );
 
29
INSERT INTO t1 VALUES ( "2000-1-4" );
 
30
INSERT INTO t1 VALUES ( "2000-1-5" );
 
31
SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND cast("2000-1-4" as date);
 
32
datum
 
33
2000-01-02
 
34
2000-01-03
 
35
2000-01-04
 
36
SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND datum - INTERVAL 100 DAY;
 
37
datum
 
38
DROP TABLE t1;
 
39
CREATE TABLE t1 (
 
40
user_id char(10),
 
41
summa int(11),
 
42
rdate date
 
43
);
 
44
INSERT INTO t1 VALUES ('aaa',100,'1998-01-01');
 
45
INSERT INTO t1 VALUES ('aaa',200,'1998-01-03');
 
46
INSERT INTO t1 VALUES ('bbb',50,'1998-01-02');
 
47
INSERT INTO t1 VALUES ('bbb',200,'1998-01-04');
 
48
select max(rdate) as s from t1 where rdate < '1998-01-03' having s> "1998-01-01";
 
49
s
 
50
1998-01-02
 
51
select max(rdate) as s from t1 having s="1998-01-04";
 
52
s
 
53
1998-01-04
 
54
select max(rdate+0) as s from t1 having s="19980104";
 
55
s
 
56
19980104
 
57
drop table t1;
 
58
create table t1 (date date);
 
59
insert into t1 values ("2000-08-10"),("2000-08-11");
 
60
select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
 
61
date_add(date,INTERVAL 1 DAY)   date_add(date,INTERVAL 1 SECOND)
 
62
2000-08-11      2000-08-10 00:00:01
 
63
2000-08-12      2000-08-11 00:00:01
 
64
drop table t1;
 
65
CREATE TABLE t1(AFIELD INT);
 
66
INSERT INTO t1 VALUES(1);
 
67
CREATE TABLE t2(GMT  VARCHAR(32));
 
68
INSERT INTO t2 VALUES('GMT-0800');
 
69
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' ,  t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD;
 
70
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' ,  t2.GMT))
 
71
Wed, 06 March 2002 10:11:12 GMT-0800
 
72
INSERT INTO t1 VALUES(1);
 
73
SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' ,  t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12",  CONCAT('%a, %d %M %Y %H:%i:%s ' ,  t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
 
74
DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' ,  t2.GMT))  DATE_FORMAT("2002-03-06 10:11:12",  CONCAT('%a, %d %M %Y %H:%i:%s ' ,  t2.GMT))
 
75
Wed, 06 March 2002 10:11:12 GMT-0800    Wed, 06 March 2002 10:11:12 GMT-0800
 
76
drop table t1,t2;
 
77
CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
 
78
INSERT INTO t1 (f1, f2) VALUES ('09:00', '12:00');
 
79
SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
 
80
DATE_FORMAT(f1, "%l.%i %p")     DATE_FORMAT(f2, "%l.%i %p")
 
81
9.00 AM 12.00 PM
 
82
DROP TABLE t1;
 
83
CREATE TABLE t1 (f1 DATE);
 
84
CREATE TABLE t2 (f2 VARCHAR(8));
 
85
CREATE TABLE t3 (f2 CHAR(8));
 
86
INSERT INTO t1 VALUES ('1978-11-26');
 
87
INSERT INTO t2 SELECT f1+0 FROM t1;
 
88
INSERT INTO t2 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1;
 
89
INSERT INTO t3 SELECT f1+0 FROM t1;
 
90
INSERT INTO t3 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1;
 
91
SELECT * FROM t2;
 
92
f2
 
93
19781126
 
94
19781126
 
95
SELECT * FROM t3;
 
96
f2
 
97
19781126
 
98
19781126
 
99
DROP TABLE t1, t2, t3;
 
100
CREATE TABLE t1 (y YEAR);
 
101
INSERT INTO t1 VALUES ('abc');
 
102
Warnings:
 
103
Warning 1366    Incorrect integer value: 'abc' for column 'y' at row 1
 
104
SELECT * FROM t1;
 
105
y
 
106
0000
 
107
DROP TABLE t1;
 
108
create table t1(start_date date, end_date date);
 
109
insert into t1 values ('2000-01-01','2000-01-02');
 
110
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
 
111
1
 
112
1
 
113
drop table t1;
 
114
select @d:=1111;
 
115
@d:=1111
 
116
1111
 
117
select year(@d), month(@d), day(@d), cast(@d as date);
 
118
year(@d)        month(@d)       day(@d) cast(@d as date)
 
119
2000    11      11      2000-11-11
 
120
select @d:=011111;
 
121
@d:=011111
 
122
11111
 
123
select year(@d), month(@d), day(@d), cast(@d as date);
 
124
year(@d)        month(@d)       day(@d) cast(@d as date)
 
125
2001    11      11      2001-11-11
 
126
select @d:=1311;
 
127
@d:=1311
 
128
1311
 
129
select year(@d), month(@d), day(@d), cast(@d as date);
 
130
year(@d)        month(@d)       day(@d) cast(@d as date)
 
131
NULL    NULL    NULL    NULL
 
132
Warnings:
 
133
Warning 1292    Incorrect datetime value: '1311'
 
134
Warning 1292    Incorrect datetime value: '1311'
 
135
Warning 1292    Incorrect datetime value: '1311'
 
136
Warning 1292    Incorrect datetime value: '1311'
 
137
create table t1 (d  date , dt datetime , ts timestamp);
 
138
insert into t1 values (9912101,9912101,9912101);
 
139
Warnings:
 
140
Warning 1265    Data truncated for column 'd' at row 1
 
141
Warning 1265    Data truncated for column 'dt' at row 1
 
142
Warning 1265    Data truncated for column 'ts' at row 1
 
143
insert into t1 values (11111,11111,11111);
 
144
select * from t1;
 
145
d       dt      ts
 
146
0000-00-00      0000-00-00 00:00:00     0000-00-00 00:00:00
 
147
2001-11-11      2001-11-11 00:00:00     2001-11-11 00:00:00
 
148
drop table t1;
 
149
CREATE TABLE t1 (
 
150
a INT
 
151
);
 
152
INSERT INTO t1 VALUES (1);
 
153
INSERT INTO t1 VALUES (NULL);
 
154
SELECT str_to_date( '', a ) FROM t1;
 
155
str_to_date( '', a )
 
156
0000-00-00 00:00:00
 
157
NULL
 
158
DROP TABLE t1;
 
159
CREATE TABLE t1 (a DATE, b int, PRIMARY KEY (a,b));
 
160
INSERT INTO t1 VALUES (DATE(NOW()), 1);
 
161
SELECT COUNT(*) FROM t1 WHERE a = NOW();
 
162
COUNT(*)
 
163
0
 
164
EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
 
165
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
166
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE noticed after reading const tables
 
167
INSERT INTO t1 VALUES (DATE(NOW()), 2);
 
168
SELECT COUNT(*) FROM t1 WHERE a = NOW();
 
169
COUNT(*)
 
170
0
 
171
EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
 
172
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
173
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE noticed after reading const tables
 
174
SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1;
 
175
COUNT(*)
 
176
0
 
177
EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1;
 
178
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
179
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE noticed after reading const tables
 
180
ALTER TABLE t1 DROP PRIMARY KEY;
 
181
SELECT COUNT(*) FROM t1 WHERE a = NOW();
 
182
COUNT(*)
 
183
0
 
184
EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
 
185
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
186
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    2       Using where
 
187
DROP TABLE t1;
 
188
CREATE TABLE t1 (a DATE);
 
189
CREATE TABLE t2 (a DATE);
 
190
CREATE INDEX i ON t1 (a);
 
191
INSERT INTO t1 VALUES ('0000-00-00'),('0000-00-00');
 
192
INSERT INTO t2 VALUES ('0000-00-00'),('0000-00-00');
 
193
SELECT * FROM t1 WHERE a = '0000-00-00';
 
194
a
 
195
0000-00-00
 
196
0000-00-00
 
197
SELECT * FROM t2 WHERE a = '0000-00-00';
 
198
a
 
199
0000-00-00
 
200
0000-00-00
 
201
SET SQL_MODE=TRADITIONAL;
 
202
EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00';
 
203
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
204
1       SIMPLE  t1      ref     i       i       4       const   2       Using index
 
205
SELECT * FROM t1 WHERE a = '0000-00-00';
 
206
a
 
207
0000-00-00
 
208
0000-00-00
 
209
SELECT * FROM t2 WHERE a = '0000-00-00';
 
210
a
 
211
0000-00-00
 
212
0000-00-00
 
213
INSERT INTO t1 VALUES ('0000-00-00');
 
214
ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
 
215
SET SQL_MODE=DEFAULT;
 
216
DROP TABLE t1,t2;
 
217
CREATE TABLE t1 (a DATE);
 
218
CREATE TABLE t2 (a DATE);
 
219
CREATE INDEX i ON t1 (a);
 
220
INSERT INTO t1 VALUES ('1000-00-00'),('1000-00-00');
 
221
INSERT INTO t2 VALUES ('1000-00-00'),('1000-00-00');
 
222
SELECT * FROM t1 WHERE a = '1000-00-00';
 
223
a
 
224
1000-00-00
 
225
1000-00-00
 
226
SELECT * FROM t2 WHERE a = '1000-00-00';
 
227
a
 
228
1000-00-00
 
229
1000-00-00
 
230
SET SQL_MODE=TRADITIONAL;
 
231
EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00';
 
232
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
 
233
1       SIMPLE  t1      ref     i       i       4       const   2       Using index
 
234
SELECT * FROM t1 WHERE a = '1000-00-00';
 
235
a
 
236
1000-00-00
 
237
1000-00-00
 
238
SELECT * FROM t2 WHERE a = '1000-00-00';
 
239
a
 
240
1000-00-00
 
241
1000-00-00
 
242
INSERT INTO t1 VALUES ('1000-00-00');
 
243
ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1
 
244
SET SQL_MODE=DEFAULT;
 
245
DROP TABLE t1,t2;
 
246
CREATE TABLE t1 SELECT curdate() AS f1;
 
247
SELECT hour(f1), minute(f1), second(f1) FROM t1;
 
248
hour(f1)        minute(f1)      second(f1)
 
249
0       0       0
 
250
DROP TABLE t1;
 
251
End of 5.0 tests
 
252
create table t1 (a date, primary key (a))engine=memory;
 
253
insert into t1 values ('0000-01-01'), ('0000-00-01'), ('0001-01-01');
 
254
select * from t1 where a between '0000-00-01' and '0000-00-02';
 
255
a
 
256
0000-00-01
 
257
drop table t1;
 
258
End of 5.1 tests