1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for bug #7297 "Two digit year should be interpreted correctly

even with zero month and day" aka "Date decoding trouble"

Two digit year should be interpreted correctly as year in 20th or 21st
century even with zero month and day. Only exception should be zero date
'00-00-00' or '00-00-00 00:00:00'.


mysql-test/r/type_datetime.result:
  Added test for bug #7297 "Two digit year should be interpreted correctly
  even with zero month and day"
mysql-test/t/type_datetime.test:
  Added test for bug #7297 "Two digit year should be interpreted correctly
  even with zero month and day"
sql/time.cc:
  str_to_TIME(): Two digit year should be interpreted correctly as year
  in 20th or 21st century even with zero month and day. Only exception 
  should be zero date '00-00-00' or '00-00-00 00:00:00'.
This commit is contained in:
unknown
2004-12-16 16:31:50 +03:00
parent f40f838f50
commit 2fb340b520
3 changed files with 23 additions and 1 deletions

View File

@ -102,3 +102,13 @@ insert into t1 values (now(), now());
select * from t1 where a is null or b is null;
a b
drop table t1;
create table t1 (dt datetime);
insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
select * from t1;
dt
2012-00-00 00:00:00
2000-00-00 01:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
drop table t1;

View File

@ -68,3 +68,15 @@ insert into t1 values (now(), now());
insert into t1 values (now(), now());
select * from t1 where a is null or b is null;
drop table t1;
#
# Test for bug #7297 "Two digit year should be interpreted correctly even
# with zero month and day"
#
create table t1 (dt datetime);
# These dates should be treated as dates in 21st century
insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
# Zero dates are still special :/
insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
select * from t1;
drop table t1;