[MDEV-456] An out-of-range datetime value (with a 5-digit year) can be created and cause troubles Created: 2012-08-15  Updated: 2013-01-08  Resolved: 2012-08-30

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.25, 5.3.7
Fix Version/s: 5.5.27, 5.3.9

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None


 Description   

 
create table t1 (d datetime);
# Query OK, 0 rows affected (0.22 sec)
 
insert into t1 values ('9999-12-31 23:59:59');
# Query OK, 1 row affected (0.00 sec)
 
update t1 set d = addtime(d, '00:00:01');
# Query OK, 1 row affected (0.00 sec)
# Rows matched: 1  Changed: 1  Warnings: 0
 
select * from t1 where d > '9999-12-31 23:59:59';
# +---------------------+
# | d                   |
# +---------------------+
# | :000-01-01 00:00:00 |
# +---------------------+
# 1 row in set (0.00 sec)

This can potentially cause problems; for one, mysqldump/restore brings up a different value (all zeros).

In MariaDB 5.2 it worked as expected – a warning 'Incorrect datetime value: '10000-01-01 00:00:00'' was produced on the update, and the value was set to NULL.


Generated at Thu Feb 08 06:28:53 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.