diff options
author | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-03-23 22:08:31 +0200 |
---|---|---|
committer | unknown <monty@mysql.com/narttu.mysql.fi> | 2007-03-23 22:08:31 +0200 |
commit | 212ecf348cbb43f71cfd14a51ca19b7ef987859f (patch) | |
tree | e49fe06028525f2e9ade2717aa57f2ed8c319576 /mysql-test | |
parent | a79e08a6e109982688cf37e5486282aa2af2a18d (diff) | |
download | mariadb-git-212ecf348cbb43f71cfd14a51ca19b7ef987859f.tar.gz |
Removed not used define YY_MAGIC_BELOW
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME
Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
include/my_time.h:
Removed not used define YY_MAGIC_BELOW
Added prototype for year_2000_handling()
mysql-test/r/date_formats.result:
Updated results (fixed bug in date_format() with year < 99)
mysql-test/r/func_sapdb.result:
Added more testing of make_date()
mysql-test/r/func_time.result:
Fixed bug in date_sub() with years < 200
mysql-test/r/ps_2myisam.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_3innodb.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_4heap.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_5merge.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_7ndb.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/type_date.result:
Added test for date conversions
mysql-test/r/type_datetime.result:
Added testcase for datetime to date conversion.
mysql-test/t/date_formats.test:
Added testing of dates < 200
mysql-test/t/func_sapdb.test:
More testing of makedate()
mysql-test/t/type_date.test:
Added test for date conversions
mysql-test/t/type_datetime.test:
Added testcase for datetime to date conversion.
sql/CMakeLists.txt:
Added library ws2_32 (needed if we want to compile with IOCP support)
sql/event_data_objects.cc:
TIME -> MYSQL_TIME
sql/event_db_repository.cc:
TIME -> MYSQL_TIME
sql/event_queue.cc:
TIME -> MYSQL_TIME
sql/field.cc:
Give note if we insert a datetime value in a date field
Don't give notes if we are doing internal test conversions (like from convert_constant_item())
More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
Revert some changes in Field_newdate::store() to get more optimal code
Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
New parameters to make_truncated_value_warning()
sql/field.h:
TIME -> MYSQL_TIME
sql/item.cc:
New parameters to make_truncated_value_warning()
Fixed get_date() to call number_to_datetime() if argument is not a string.
Fixes Bug#23093 Implicit conversion of 9912101 to date does not match cast(9912101 as date)
sql/item.h:
TIME -> MYSQL_TIME
sql/item_cmpfunc.cc:
Don't print notes in convert_constant_item()
sql/item_func.h:
TIME -> MYSQL_TIME
sql/item_timefunc.cc:
New parameters to make_truncated_value_warning()
Moved year 2000 handling out from calc_days()
Don't return NULL for years < 200 in date_add/date_sub
sql/item_timefunc.h:
TIME -> MYSQL_TIME
sql/my_decimal.cc:
TIME -> MYSQL_TIME
sql/my_decimal.h:
TIME -> MYSQL_TIME
sql/mysql_priv.h:
Added error level to make_truncated_value_warning()
sql/protocol.cc:
TIME -> MYSQL_TIME
sql/protocol.h:
TIME -> MYSQL_TIME
sql/sp.cc:
TIME -> MYSQL_TIME
sql/sql_base.cc:
Make testing of result value of save_in_field() uniform
sql-common/my_time.c:
Added year_2000_handling()
Removed year 2000 handling from calc_daynr()
sql/sql_class.h:
TIME -> MYSQL_TIME
sql/sql_show.cc:
TIME -> MYSQL_TIME
sql/structs.h:
TIME -> MYSQL_TIME
sql/time.cc:
Added error level to make_truncated_value_warning()
sql/tztime.cc:
TIME -> MYSQL_TIME
sql/tztime.h:
TIME -> MYSQL_TIME
sql/unireg.cc:
For default values to CREATE, don't give errors for warning level NOTE
(Fixed failed CREATE when we give a datetime value to a date field)
strings/ctype-utf8.c:
Fixed compiler failures
win/README:
More comments
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/date_formats.result | 18 | ||||
-rw-r--r-- | mysql-test/r/func_sapdb.result | 6 | ||||
-rw-r--r-- | mysql-test/r/func_time.result | 10 | ||||
-rw-r--r-- | mysql-test/r/ps_2myisam.result | 7 | ||||
-rw-r--r-- | mysql-test/r/ps_3innodb.result | 7 | ||||
-rw-r--r-- | mysql-test/r/ps_4heap.result | 7 | ||||
-rw-r--r-- | mysql-test/r/ps_5merge.result | 14 | ||||
-rw-r--r-- | mysql-test/r/ps_7ndb.result | 7 | ||||
-rw-r--r-- | mysql-test/r/type_date.result | 26 | ||||
-rw-r--r-- | mysql-test/r/type_datetime.result | 35 | ||||
-rw-r--r-- | mysql-test/t/date_formats.test | 2 | ||||
-rw-r--r-- | mysql-test/t/func_sapdb.test | 2 | ||||
-rw-r--r-- | mysql-test/t/type_date.test | 13 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 22 |
14 files changed, 169 insertions, 7 deletions
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index cf3495ef26d..92170a64b29 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -91,6 +91,8 @@ create table t1 (date char(30), format char(30) not null); insert into t1 values ('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'), ('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'), +('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'), +('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'), ('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'), ('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'), ('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'), @@ -122,6 +124,8 @@ select date,format,str_to_date(date, format) as str_to_date from t1; date format str_to_date 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12 03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450 @@ -153,6 +157,8 @@ select date,format,concat('',str_to_date(date, format)) as con from t1; date format con 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12 03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450 @@ -184,6 +190,8 @@ select date,format,cast(str_to_date(date, format) as datetime) as datetime from date format datetime 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12 03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450 @@ -222,6 +230,8 @@ select date,format,DATE(str_to_date(date, format)) as date2 from t1; date format date2 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 @@ -253,6 +263,8 @@ select date,format,TIME(str_to_date(date, format)) as time from t1; date format time 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 @@ -291,6 +303,8 @@ select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1; date format time2 2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12 03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02 +0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 +03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02 2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12 2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450 2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450 @@ -423,14 +437,14 @@ select date,format,str_to_date(date, format) as str_to_date from t1; date format str_to_date 10:20:10AM %h:%i:%s 0000-00-00 10:20:10 2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 -03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12 +03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 Warnings: Warning 1292 Incorrect datetime value: '10:20:10AM' select date,format,concat(str_to_date(date, format),'') as con from t1; date format con 10:20:10AM %h:%i:%s 0000-00-00 10:20:10 2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12 -03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12 +03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12 Warnings: Warning 1292 Incorrect datetime value: '10:20:10AM' drop table t1; diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index 124b20e9b46..b7dbfc670a8 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -75,6 +75,12 @@ NULL select weekofyear("1997-11-30 23:59:59.000001"); weekofyear("1997-11-30 23:59:59.000001") 48 +select makedate(03,1); +makedate(03,1) +2003-01-01 +select makedate('0003',1); +makedate('0003',1) +2003-01-01 select makedate(1997,1); makedate(1997,1) 1997-01-01 diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 16a1e5d01d7..2d59a32218c 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1225,13 +1225,13 @@ TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s") End of 5.0 tests select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND) -NULL +0049-12-31 23:59:59 select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND) -NULL +0198-12-31 23:59:59 select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND); date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND) -NULL +0200-01-01 00:00:01 select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND) 0199-12-31 23:59:59 @@ -1252,8 +1252,8 @@ date_sub("90-01-01 00:00:01",INTERVAL 2 SECOND) 1989-12-31 23:59:59 select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND) -NULL +0068-12-31 23:59:59 select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND) -NULL +0168-12-31 23:59:59 End of 5.1 tests diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index af7a762c5a8..d18bb8dc434 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -2961,20 +2961,26 @@ delete from t9 ; test_sequence -- insert into date/time columns -- Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1264 Out of range value for column 'c13' at row 1 @@ -3005,6 +3011,7 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 8c0b9f1e19b..e6ff668760c 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -2944,20 +2944,26 @@ delete from t9 ; test_sequence -- insert into date/time columns -- Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1264 Out of range value for column 'c13' at row 1 @@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 7ad6e3ea722..046992806cc 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -2945,20 +2945,26 @@ delete from t9 ; test_sequence -- insert into date/time columns -- Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1264 Out of range value for column 'c13' at row 1 @@ -2989,6 +2995,7 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 1e2c27e6e4f..bbdb80df5d4 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -2881,20 +2881,26 @@ delete from t9 ; test_sequence -- insert into date/time columns -- Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1264 Out of range value for column 'c13' at row 1 @@ -2925,6 +2931,7 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 @@ -5895,20 +5902,26 @@ delete from t9 ; test_sequence -- insert into date/time columns -- Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1264 Out of range value for column 'c13' at row 1 @@ -5939,6 +5952,7 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index e43f6b4ed6c..20d38ba84bd 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -2944,20 +2944,26 @@ delete from t9 ; test_sequence -- insert into date/time columns -- Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1265 Data truncated for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c17' at row 1 Warnings: Warning 1264 Out of range value for column 'c13' at row 1 @@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 Warnings: +Note 1265 Data truncated for column 'c13' at row 1 Warning 1265 Data truncated for column 'c15' at row 1 Warning 1264 Out of range value for column 'c16' at row 1 Warning 1264 Out of range value for column 'c17' at row 1 diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 12ce742eab4..4b651c137ad 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -110,3 +110,29 @@ select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_dat 1 1 drop table t1; +select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date); +@d:=1111 year(@d) month(@d) day(@d) cast(@d as date) +1111 2000 11 11 2000-11-11 +select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date); +@d:=011111 year(@d) month(@d) day(@d) cast(@d as date) +11111 2001 11 11 2001-11-11 +select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date); +@d:=1311 year(@d) month(@d) day(@d) cast(@d as date) +1311 NULL NULL NULL NULL +Warnings: +Warning 1292 Incorrect datetime value: '1311' +Warning 1292 Incorrect datetime value: '1311' +Warning 1292 Incorrect datetime value: '1311' +Warning 1292 Incorrect datetime value: '1311' +create table t1 (d date , dt datetime , ts timestamp); +insert into t1 values (9912101,9912101,9912101); +Warnings: +Warning 1264 Out of range value for column 'd' at row 1 +Warning 1264 Out of range value for column 'dt' at row 1 +Warning 1265 Data truncated for column 'ts' at row 1 +insert into t1 values (11111,11111,11111); +select * from t1; +d dt ts +0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 +2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00 +drop table t1; diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index b54bd155c7d..56770371a1e 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -194,3 +194,38 @@ CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMA SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6)); CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6)) 101112.098700 +set @org_mode=@@sql_mode; +create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03'); +Warnings: +Note 1265 Data truncated for column 'da' at row 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `da` date DEFAULT '1962-03-03', + `dt` datetime DEFAULT '1962-03-03 00:00:00' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values (); +insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38'); +Warnings: +Note 1265 Data truncated for column 'da' at row 1 +set @@sql_mode='ansi,traditional'; +insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38'); +Warnings: +Note 1265 Data truncated for column 'da' at row 1 +insert into t1 set dt='2007-03-23 13:49:38',da=dt; +Warnings: +Note 1265 Data truncated for column 'da' at row 1 +insert into t1 values ('2007-03-32','2007-03-23 13:49:38'); +ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1 +select * from t1; +da dt +1962-03-03 1962-03-03 00:00:00 +2007-03-23 2007-03-23 13:49:38 +2007-03-23 2007-03-23 13:49:38 +2007-03-23 2007-03-23 13:49:38 +drop table t1; +create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03'); +ERROR 42000: Invalid default value for 'da' +create table t1 (t time default '916:00:00 a'); +ERROR 42000: Invalid default value for 't' +set @@sql_mode= @org_mode; diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index 64bd69c1855..fe39cd95753 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -132,6 +132,8 @@ create table t1 (date char(30), format char(30) not null); insert into t1 values ('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'), ('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'), +('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'), +('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'), ('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'), ('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'), ('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'), diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test index 77d7366afe6..bb65cbaa774 100644 --- a/mysql-test/t/func_sapdb.test +++ b/mysql-test/t/func_sapdb.test @@ -41,6 +41,8 @@ select datediff("1997-11-30 23:59:59.000001",null); select weekofyear("1997-11-30 23:59:59.000001"); +select makedate(03,1); +select makedate('0003',1); select makedate(1997,1); select makedate(1997,0); select makedate(9999,365); diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index c6050753943..02cd07e3c16 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -123,3 +123,16 @@ insert into t1 values ('2000-01-01','2000-01-02'); select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date; drop table t1; # End of 4.1 tests + +# +# Bug #23093: Implicit conversion of 9912101 to date does not match +# cast(9912101 as date) +# +select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date); +select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date); +select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date); +create table t1 (d date , dt datetime , ts timestamp); +insert into t1 values (9912101,9912101,9912101); +insert into t1 values (11111,11111,11111); +select * from t1; +drop table t1; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 9246080630e..b4c10408b37 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -141,3 +141,25 @@ SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6)); SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6)); SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6)); +# +# Test of storing datetime into date fields +# + +set @org_mode=@@sql_mode; +create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03'); +show create table t1; +insert into t1 values (); +insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38'); +set @@sql_mode='ansi,traditional'; +insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38'); +insert into t1 set dt='2007-03-23 13:49:38',da=dt; +# Test error handling +--error 1292 +insert into t1 values ('2007-03-32','2007-03-23 13:49:38'); +select * from t1; +drop table t1; +--error 1067 +create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03'); +--error 1067 +create table t1 (t time default '916:00:00 a'); +set @@sql_mode= @org_mode; |