17
17
# All test cases expected to fail should return
18
18
# SQLSTATE 22007 <invalid date value>
19
--error ER_TRUNCATED_WRONG_VALUE
20
20
INSERT INTO t1 VALUES('2004-0-31');
21
--error ER_TRUNCATED_WRONG_VALUE
22
22
INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
23
--error ER_TRUNCATED_WRONG_VALUE
24
24
INSERT INTO t1 VALUES('2004-10-0');
25
--error ER_TRUNCATED_WRONG_VALUE
26
26
INSERT INTO t1 VALUES('2004-09-31');
27
--error ER_TRUNCATED_WRONG_VALUE
28
28
INSERT INTO t1 VALUES('2004-10-32');
29
--error ER_TRUNCATED_WRONG_VALUE
30
30
INSERT INTO t1 VALUES('2003-02-29');
31
--error ER_TRUNCATED_WRONG_VALUE
32
32
INSERT INTO t1 VALUES('2004-13-15');
33
--error ER_TRUNCATED_WRONG_VALUE
34
34
INSERT INTO t1 VALUES('0000-00-00');
35
35
# Standard says we should return SQLSTATE 22018
36
--error ER_TRUNCATED_WRONG_VALUE
37
37
INSERT INTO t1 VALUES ('59');
39
39
# Test the different related modes
40
40
set @@sql_mode='STRICT_ALL_TABLES';
41
41
INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31');
42
42
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
43
--error ER_TRUNCATED_WRONG_VALUE
44
44
INSERT INTO t1 VALUES('2004-0-30');
45
--error ER_TRUNCATED_WRONG_VALUE
46
46
INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05');
47
47
INSERT INTO t1 VALUES('0000-00-00');
48
48
INSERT IGNORE INTO t1 VALUES('2004-0-29');
49
49
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
50
--error ER_TRUNCATED_WRONG_VALUE
51
51
INSERT INTO t1 VALUES('0000-00-00');
52
52
INSERT IGNORE INTO t1 VALUES('0000-00-00');
53
53
INSERT INTO t1 VALUES ('2004-0-30');
54
--error ER_TRUNCATED_WRONG_VALUE
55
55
INSERT INTO t1 VALUES ('2004-2-30');
56
56
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
57
57
INSERT INTO t1 VALUES ('2004-2-30');
65
65
set @@sql_mode='strict_trans_tables';
66
66
CREATE TABLE t1 (col1 date) engine=myisam;
67
--error ER_TRUNCATED_WRONG_VALUE
68
68
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
69
69
INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3');
70
70
INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4');
71
--error ER_TRUNCATED_WRONG_VALUE
72
72
INSERT INTO t1 VALUES ('2003-02-29');
73
73
INSERT ignore INTO t1 VALUES('2003-02-30');
74
74
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
79
79
set @@sql_mode='strict_trans_tables';
80
80
CREATE TABLE t1 (col1 date) engine=innodb;
81
--error ER_TRUNCATED_WRONG_VALUE
82
82
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
83
--error ER_TRUNCATED_WRONG_VALUE
84
84
INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3');
85
85
INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4');
86
--error ER_TRUNCATED_WRONG_VALUE
87
87
INSERT INTO t1 VALUES ('2003-02-29');
88
88
INSERT ignore INTO t1 VALUES('2003-02-30');
89
89
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
101
101
# All test cases expected to fail should return
102
102
# SQLSTATE 22007 <invalid datetime value>
103
--error ER_TRUNCATED_WRONG_VALUE
104
104
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
105
--error ER_TRUNCATED_WRONG_VALUE
106
106
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
107
--error ER_TRUNCATED_WRONG_VALUE
108
108
INSERT INTO t1 VALUES('2004-09-31 15:30:00');
109
--error ER_TRUNCATED_WRONG_VALUE
110
110
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
111
--error ER_TRUNCATED_WRONG_VALUE
112
112
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
113
--error ER_TRUNCATED_WRONG_VALUE
114
114
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
115
--error ER_TRUNCATED_WRONG_VALUE
116
116
INSERT INTO t1 VALUES('0000-00-00 15:30:00');
117
117
# Standard says we should return SQLSTATE 22018
118
--error ER_TRUNCATED_WRONG_VALUE
119
119
INSERT INTO t1 VALUES ('59');
120
120
select * from t1;
129
129
# All test cases expected to fail should return
130
130
# SQLSTATE 22007 <invalid datetime value>
131
131
# Standard says we should return ok, but we can't as this is out of range
132
--error ER_TRUNCATED_WRONG_VALUE
133
133
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
134
--error ER_TRUNCATED_WRONG_VALUE
135
135
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
136
--error ER_TRUNCATED_WRONG_VALUE
137
137
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
138
--error ER_TRUNCATED_WRONG_VALUE
139
139
INSERT INTO t1 VALUES('2004-09-31 15:30:00');
140
--error ER_TRUNCATED_WRONG_VALUE
141
141
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
142
--error ER_TRUNCATED_WRONG_VALUE
143
143
INSERT INTO t1 VALUES('2003-02-29 15:30:00');
144
--error ER_TRUNCATED_WRONG_VALUE
145
145
INSERT INTO t1 VALUES('2004-13-15 15:30:00');
146
--error ER_TRUNCATED_WRONG_VALUE
147
147
INSERT INTO t1 VALUES('2004-02-29 25:30:00');
148
--error ER_TRUNCATED_WRONG_VALUE
149
149
INSERT INTO t1 VALUES('2004-02-29 15:65:00');
150
--error ER_TRUNCATED_WRONG_VALUE
151
151
INSERT INTO t1 VALUES('2004-02-29 15:31:61');
152
--error ER_TRUNCATED_WRONG_VALUE
153
153
INSERT INTO t1 VALUES('0000-00-00 15:30:00');
154
--error ER_TRUNCATED_WRONG_VALUE
155
155
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
156
156
INSERT IGNORE INTO t1 VALUES('0000-00-00 00:00:00');
157
157
# Standard says we should return SQLSTATE 22018
158
--error ER_TRUNCATED_WRONG_VALUE
159
159
INSERT INTO t1 VALUES ('59');
161
161
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
162
--error ER_TRUNCATED_WRONG_VALUE
163
163
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
164
--error ER_TRUNCATED_WRONG_VALUE
165
165
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
166
--error ER_TRUNCATED_WRONG_VALUE
167
167
INSERT INTO t1 VALUES('2004-10-32 15:30:00');
168
--error ER_TRUNCATED_WRONG_VALUE
169
169
INSERT INTO t1 VALUES('2004-02-30 15:30:04');
170
170
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
171
171
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
172
172
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
173
173
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
174
--error ER_TRUNCATED_WRONG_VALUE
175
175
INSERT INTO t1 VALUES('0000-00-00 00:00:00');
176
176
set @@sql_mode='ansi,traditional';
177
177
SELECT * FROM t1;
192
192
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
194
--error ER_TRUNCATED_WRONG_VALUE
195
195
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
196
--error ER_TRUNCATED_WRONG_VALUE
197
197
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
198
--error ER_TRUNCATED_WRONG_VALUE
199
199
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
200
--error ER_WRONG_VALUE_FOR_TYPE
201
201
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
202
--error ER_TRUNCATED_WRONG_VALUE
203
203
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
204
--error ER_WRONG_VALUE_FOR_TYPE
205
205
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
206
--error ER_TRUNCATED_WRONG_VALUE
207
207
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
209
209
## Test INSERT with STR_TO_DATE into DATETIME
213
213
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
215
--error ER_TRUNCATED_WRONG_VALUE
216
216
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
217
--error ER_TRUNCATED_WRONG_VALUE
218
218
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
219
--error ER_TRUNCATED_WRONG_VALUE
220
220
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
221
--error ER_WRONG_VALUE_FOR_TYPE
222
222
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
223
--error ER_TRUNCATED_WRONG_VALUE
224
224
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
225
--error ER_WRONG_VALUE_FOR_TYPE
226
226
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
227
--error ER_TRUNCATED_WRONG_VALUE
228
228
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
230
230
## Test INSERT with STR_TO_DATE into TIMESTAMP
231
231
# All test cases expected to fail should return
232
232
# SQLSTATE 22007 <invalid datetime value>
234
--error ER_TRUNCATED_WRONG_VALUE
235
235
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
236
--error ER_TRUNCATED_WRONG_VALUE
237
237
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
238
--error ER_TRUNCATED_WRONG_VALUE
239
239
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
240
--error ER_TRUNCATED_WRONG_VALUE
241
241
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
242
--error ER_WRONG_VALUE_FOR_TYPE
243
243
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
244
--error ER_TRUNCATED_WRONG_VALUE
245
245
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
246
--error ER_WRONG_VALUE_FOR_TYPE
247
247
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
248
--error ER_TRUNCATED_WRONG_VALUE
249
249
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
266
266
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
268
--error ER_TRUNCATED_WRONG_VALUE
269
269
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
270
--error ER_TRUNCATED_WRONG_VALUE
271
271
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
273
273
# deactivated because of Bug#8294
274
274
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
275
# --error ER_TRUNCATED_WRONG_VALUE
276
276
# INSERT INTO t1 (col1) VALUES(CAST('2004-9-31' AS DATE));
277
# --error ER_TRUNCATED_WRONG_VALUE
278
278
# INSERT INTO t1 (col1) VALUES(CAST('2004-10-32' AS DATE));
279
# --error ER_TRUNCATED_WRONG_VALUE
280
280
# INSERT INTO t1 (col1) VALUES(CAST('2003-02-29' AS DATE));
281
# --error ER_TRUNCATED_WRONG_VALUE
282
282
# INSERT INTO t1 (col1) VALUES(CAST('2004-13-15' AS DATE));
284
284
# deactivated because of Bug#6145
285
285
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
286
--error ER_TRUNCATED_WRONG_VALUE
287
287
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
289
289
## Test INSERT with CAST AS DATETIME into DATETIME
293
293
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
295
--error ER_TRUNCATED_WRONG_VALUE
296
296
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
297
--error ER_TRUNCATED_WRONG_VALUE
298
298
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
300
300
# deactivated because of Bug#8294
301
301
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
302
#--error ER_TRUNCATED_WRONG_VALUE
303
303
#INSERT INTO t1 (col2) VALUES(CAST('2004-9-31 15:30' AS DATETIME));
304
#--error ER_TRUNCATED_WRONG_VALUE
305
305
#INSERT INTO t1 (col2) VALUES(CAST('2004-10-32 15:30' AS DATETIME));
306
#--error ER_TRUNCATED_WRONG_VALUE
307
307
#INSERT INTO t1 (col2) VALUES(CAST('2003-02-29 15:30' AS DATETIME));
308
#--error ER_TRUNCATED_WRONG_VALUE
309
309
#INSERT INTO t1 (col2) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
311
311
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
312
--error ER_TRUNCATED_WRONG_VALUE
313
313
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
315
315
## Test INSERT with CAST AS DATETIME into TIMESTAMP
316
316
# All test cases expected to fail should return
317
317
# SQLSTATE 22007 <invalid datetime value>
318
--error ER_TRUNCATED_WRONG_VALUE
319
319
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
320
320
# should return OK
321
321
# We accept this to be a failure
323
--error ER_TRUNCATED_WRONG_VALUE
324
324
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
325
--error ER_TRUNCATED_WRONG_VALUE
326
326
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
327
327
# should return SQLSTATE 22007 <invalid datetime value>
329
329
# deactivated because of Bug#8294
330
330
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
331
#--error ER_TRUNCATED_WRONG_VALUE
332
332
#INSERT INTO t1 (col3) VALUES(CAST('2004-9-31 15:30' AS DATETIME));
333
#--error ER_TRUNCATED_WRONG_VALUE
334
334
#INSERT INTO t1 (col3) VALUES(CAST('2004-10-32 15:30' AS DATETIME));
335
#--error ER_TRUNCATED_WRONG_VALUE
336
336
#INSERT INTO t1 (col3) VALUES(CAST('2003-02-29 15:30' AS DATETIME));
337
#--error ER_TRUNCATED_WRONG_VALUE
338
338
#INSERT INTO t1 (col3) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
340
340
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
341
--error ER_TRUNCATED_WRONG_VALUE
342
342
INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME));
360
360
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
362
--error ER_TRUNCATED_WRONG_VALUE
363
363
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
364
--error ER_TRUNCATED_WRONG_VALUE
365
365
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
367
367
# deactivated because of Bug#8294
368
368
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
369
#--error ER_TRUNCATED_WRONG_VALUE
370
370
#INSERT INTO t1 (col1) VALUES(CONVERT('2004-9-31' , DATE));
371
#--error ER_TRUNCATED_WRONG_VALUE
372
372
#INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-32' , DATE));
373
#--error ER_TRUNCATED_WRONG_VALUE
374
374
#INSERT INTO t1 (col1) VALUES(CONVERT('2003-02-29' , DATE));
375
#--error ER_TRUNCATED_WRONG_VALUE
376
376
#INSERT INTO t1 (col1) VALUES(CONVERT('2004-13-15',DATE));
378
378
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
379
--error ER_TRUNCATED_WRONG_VALUE
380
380
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
382
382
## Test INSERT with CONVERT to DATETIME into DATETIME
386
386
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
388
--error ER_TRUNCATED_WRONG_VALUE
389
389
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
390
--error ER_TRUNCATED_WRONG_VALUE
391
391
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
393
393
# deactivated because of Bug#8294
394
394
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
395
#--error ER_TRUNCATED_WRONG_VALUE
396
396
#INSERT INTO t1 (col2) VALUES(CONVERT('2004-9-31 15:30',DATETIME));
397
#--error ER_TRUNCATED_WRONG_VALUE
398
398
#INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-32 15:30',DATETIME));
399
#--error ER_TRUNCATED_WRONG_VALUE
400
400
#INSERT INTO t1 (col2) VALUES(CONVERT('2003-02-29 15:30',DATETIME));
401
#--error ER_TRUNCATED_WRONG_VALUE
402
402
#INSERT INTO t1 (col2) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
404
404
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
405
--error ER_TRUNCATED_WRONG_VALUE
406
406
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
408
408
## Test INSERT with CONVERT to DATETIME into DATETIME
409
409
# All test cases expected to fail should return
410
410
# SQLSTATE 22007 <invalid datetime value>
411
--error ER_TRUNCATED_WRONG_VALUE
412
412
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
413
413
# should return OK
414
414
# We accept this to be a failure
416
--error ER_TRUNCATED_WRONG_VALUE
417
417
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
418
--error ER_TRUNCATED_WRONG_VALUE
419
419
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
421
421
# deactivated because of Bug#8294
422
422
# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
423
#--error ER_TRUNCATED_WRONG_VALUE
424
424
#INSERT INTO t1 (col3) VALUES(CONVERT('2004-9-31 15:30',DATETIME));
425
#--error ER_TRUNCATED_WRONG_VALUE
426
426
#INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-32 15:30',DATETIME));
427
#--error ER_TRUNCATED_WRONG_VALUE
428
428
#INSERT INTO t1 (col3) VALUES(CONVERT('2003-02-29 15:30',DATETIME));
429
#--error ER_TRUNCATED_WRONG_VALUE
430
430
#INSERT INTO t1 (col3) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
432
432
# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
433
--error ER_TRUNCATED_WRONG_VALUE
434
434
INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME));
442
442
create table t1 (col1 date, col2 datetime, col3 timestamp);
443
--error ER_TRUNCATED_WRONG_VALUE
444
444
insert into t1 values (0,0,0);
445
--error ER_TRUNCATED_WRONG_VALUE
446
446
insert into t1 values (0.0,0.0,0.0);
447
--error ER_TRUNCATED_WRONG_VALUE
448
448
insert into t1 (col1) values (convert('0000-00-00',date));
449
--error ER_TRUNCATED_WRONG_VALUE
450
450
insert into t1 (col1) values (cast('0000-00-00' as date));
452
452
set sql_mode='no_zero_date';
456
456
set sql_mode='traditional';
457
457
create table t1 (col1 date);
458
458
insert ignore into t1 values ('0000-00-00');
459
--error ER_TRUNCATED_WRONG_VALUE
460
460
insert into t1 select * from t1;
461
461
insert ignore into t1 values ('0000-00-00');
462
462
insert ignore into t1 (col1) values (cast('0000-00-00' as date));
463
--error ER_TRUNCATED_WRONG_VALUE
464
464
insert into t1 select * from t1;
465
--error ER_TRUNCATED_WRONG_VALUE
466
466
alter table t1 modify col1 datetime;
467
467
alter ignore table t1 modify col1 datetime;
468
--error ER_TRUNCATED_WRONG_VALUE
469
469
insert into t1 select * from t1;
470
470
select * from t1;
474
474
# Bug #5906: handle invalid date due to conversion
476
476
create table t1 (d date);
477
--error ER_TRUNCATED_WRONG_VALUE
478
478
insert into t1 values ('2000-10-00');
479
--error ER_TRUNCATED_WRONG_VALUE
480
480
insert into t1 values (1000);
481
481
insert into t1 values ('2000-10-01');
482
--error ER_TRUNCATED_WRONG_VALUE
483
483
update t1 set d = 1100;
484
484
select * from t1;