summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/my_time.h11
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_func_view.result122
-rw-r--r--mysql-test/suite/funcs_1/r/memory_func_view.result122
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_func_view.result122
-rw-r--r--mysql-test/suite/pbxt/r/func_sapdb.result4
-rw-r--r--mysql-test/suite/pbxt/r/func_timestamp.result4
-rw-r--r--mysql-test/suite/pbxt/r/range.result7
-rw-r--r--mysql-test/suite/pbxt/r/select.result8
-rw-r--r--mysql-test/suite/pbxt/r/type_datetime.result2
-rw-r--r--mysql-test/suite/pbxt/r/type_time.result8
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result8
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test1
-rw-r--r--sql-common/my_time.c2
-rw-r--r--sql/field.cc17
-rw-r--r--sql/field.h2
-rw-r--r--sql/field_conv.cc8
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/time.cc12
19 files changed, 193 insertions, 271 deletions
diff --git a/include/my_time.h b/include/my_time.h
index 8e5742f7603..c71ac4ace17 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -99,6 +99,17 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
ulong flags, int *was_cut);
longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
uint flags, int *was_cut);
+
+static inline
+longlong double_to_datetime(double nr, MYSQL_TIME *ltime, uint flags, int *cut)
+{
+ if (nr < 0 || nr > LONGLONG_MAX)
+ nr= (double)LONGLONG_MAX;
+ return number_to_datetime((longlong) floor(nr),
+ (ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR),
+ ltime, flags, cut);
+}
+
int number_to_time(my_bool neg, longlong nr, ulong sec_part,
MYSQL_TIME *ltime, int *was_cut);
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *);
diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result
index ca1b0cf82f3..0d514e7b8e6 100644
--- a/mysql-test/suite/funcs_1/r/innodb_func_view.result
+++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result
@@ -3540,10 +3540,10 @@ my_year, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL order by id;
CAST(my_year AS TIME) my_year id
NULL NULL 1
-00:19:01 1901 2
-00:21:55 2155 3
-00:20:00 2000 4
-00:20:05 2005 5
+00:00:00 1901 2
+00:00:00 2155 3
+00:00:00 2000 4
+00:00:00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as time) AS `CAST(my_year AS TIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3552,10 +3552,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL) order by id;
CAST(my_year AS TIME) my_year id
NULL NULL 1
-00:19:01 1901 2
-00:21:55 2155 3
-00:20:00 2000 4
-00:20:05 2005 5
+00:00:00 1901 2
+00:00:00 2155 3
+00:00:00 2000 4
+00:00:00 2005 5
DROP VIEW v1;
@@ -3676,8 +3676,8 @@ NULL 1.7976931348623e+308 3
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308'
-Warning 1292 Truncated incorrect time value: '1.7976931348623e+308'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3692,8 +3692,8 @@ NULL 1.7976931348623e+308 3
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308'
-Warning 1292 Truncated incorrect time value: '1.7976931348623e+308'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
DROP VIEW v1;
@@ -3886,15 +3886,10 @@ my_year, id FROM t1_values
WHERE select_id = 47 OR select_id IS NULL order by id;
CAST(my_year AS DATETIME) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 00:00:00 1901 2
+2155-00-00 00:00:00 2155 3
+2000-00-00 00:00:00 2000 4
+2005-00-00 00:00:00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as datetime) AS `CAST(my_year AS DATETIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3903,15 +3898,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 47 OR select_id IS NULL) order by id;
CAST(my_year AS DATETIME) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 00:00:00 1901 2
+2155-00-00 00:00:00 2155 3
+2000-00-00 00:00:00 2000 4
+2005-00-00 00:00:00 2005 5
DROP VIEW v1;
@@ -3923,12 +3913,11 @@ WHERE select_id = 46 OR select_id IS NULL order by id;
CAST(my_time AS DATETIME) my_time id
NULL NULL 1
NULL -838:59:59 2
-NULL 838:59:59 3
+0000-01-03 22:59:59 838:59:59 3
0000-00-00 13:00:00 13:00:00 4
0000-00-00 10:00:00 10:00:00 5
Warnings:
Warning 1292 Truncated incorrect datetime value: '-838:59:59'
-Warning 1292 Truncated incorrect datetime value: '838:59:59'
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as datetime) AS `CAST(my_time AS DATETIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3938,12 +3927,11 @@ WHERE select_id = 46 OR select_id IS NULL) order by id;
CAST(my_time AS DATETIME) my_time id
NULL NULL 1
NULL -838:59:59 2
-NULL 838:59:59 3
+0000-01-03 22:59:59 838:59:59 3
0000-00-00 13:00:00 13:00:00 4
0000-00-00 10:00:00 10:00:00 5
Warnings:
Warning 1292 Truncated incorrect datetime value: '-838:59:59'
-Warning 1292 Truncated incorrect datetime value: '838:59:59'
DROP VIEW v1;
@@ -4034,15 +4022,14 @@ CAST(my_double AS DATETIME) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 00:00:00 0 4
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
-Warning 1292 Incorrect datetime value: '200506271758'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 19
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4053,15 +4040,14 @@ CAST(my_double AS DATETIME) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 00:00:00 0 4
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
-Warning 1292 Incorrect datetime value: '200506271758'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 1
DROP VIEW v1;
@@ -4266,15 +4252,10 @@ my_year, id FROM t1_values
WHERE select_id = 36 OR select_id IS NULL order by id;
CAST(my_year AS DATE) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 1901 2
+2155-00-00 2155 3
+2000-00-00 2000 4
+2005-00-00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as date) AS `CAST(my_year AS DATE)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4283,15 +4264,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 36 OR select_id IS NULL) order by id;
CAST(my_year AS DATE) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 1901 2
+2155-00-00 2155 3
+2000-00-00 2000 4
+2005-00-00 2005 5
DROP VIEW v1;
@@ -4408,14 +4384,13 @@ CAST(my_double AS DATE) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 0 4
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4426,14 +4401,13 @@ CAST(my_double AS DATE) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 0 4
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result
index bcef7bae827..61b375fbc1e 100644
--- a/mysql-test/suite/funcs_1/r/memory_func_view.result
+++ b/mysql-test/suite/funcs_1/r/memory_func_view.result
@@ -3541,10 +3541,10 @@ my_year, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL order by id;
CAST(my_year AS TIME) my_year id
NULL NULL 1
-00:19:01 1901 2
-00:21:55 2155 3
-00:20:00 2000 4
-00:20:05 2005 5
+00:00:00 1901 2
+00:00:00 2155 3
+00:00:00 2000 4
+00:00:00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as time) AS `CAST(my_year AS TIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3553,10 +3553,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL) order by id;
CAST(my_year AS TIME) my_year id
NULL NULL 1
-00:19:01 1901 2
-00:21:55 2155 3
-00:20:00 2000 4
-00:20:05 2005 5
+00:00:00 1901 2
+00:00:00 2155 3
+00:00:00 2000 4
+00:00:00 2005 5
DROP VIEW v1;
@@ -3677,8 +3677,8 @@ NULL 1.7976931348623e+308 3
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308'
-Warning 1292 Truncated incorrect time value: '1.7976931348623e+308'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3693,8 +3693,8 @@ NULL 1.7976931348623e+308 3
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308'
-Warning 1292 Truncated incorrect time value: '1.7976931348623e+308'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
DROP VIEW v1;
@@ -3887,15 +3887,10 @@ my_year, id FROM t1_values
WHERE select_id = 47 OR select_id IS NULL order by id;
CAST(my_year AS DATETIME) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 00:00:00 1901 2
+2155-00-00 00:00:00 2155 3
+2000-00-00 00:00:00 2000 4
+2005-00-00 00:00:00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as datetime) AS `CAST(my_year AS DATETIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3904,15 +3899,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 47 OR select_id IS NULL) order by id;
CAST(my_year AS DATETIME) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 00:00:00 1901 2
+2155-00-00 00:00:00 2155 3
+2000-00-00 00:00:00 2000 4
+2005-00-00 00:00:00 2005 5
DROP VIEW v1;
@@ -3924,12 +3914,11 @@ WHERE select_id = 46 OR select_id IS NULL order by id;
CAST(my_time AS DATETIME) my_time id
NULL NULL 1
NULL -838:59:59 2
-NULL 838:59:59 3
+0000-01-03 22:59:59 838:59:59 3
0000-00-00 13:00:00 13:00:00 4
0000-00-00 10:00:00 10:00:00 5
Warnings:
Warning 1292 Truncated incorrect datetime value: '-838:59:59'
-Warning 1292 Truncated incorrect datetime value: '838:59:59'
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as datetime) AS `CAST(my_time AS DATETIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3939,12 +3928,11 @@ WHERE select_id = 46 OR select_id IS NULL) order by id;
CAST(my_time AS DATETIME) my_time id
NULL NULL 1
NULL -838:59:59 2
-NULL 838:59:59 3
+0000-01-03 22:59:59 838:59:59 3
0000-00-00 13:00:00 13:00:00 4
0000-00-00 10:00:00 10:00:00 5
Warnings:
Warning 1292 Truncated incorrect datetime value: '-838:59:59'
-Warning 1292 Truncated incorrect datetime value: '838:59:59'
DROP VIEW v1;
@@ -4035,15 +4023,14 @@ CAST(my_double AS DATETIME) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 00:00:00 0 4
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
-Warning 1292 Incorrect datetime value: '200506271758'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 6
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4054,15 +4041,14 @@ CAST(my_double AS DATETIME) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 00:00:00 0 4
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
-Warning 1292 Incorrect datetime value: '200506271758'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 1
DROP VIEW v1;
@@ -4267,15 +4253,10 @@ my_year, id FROM t1_values
WHERE select_id = 36 OR select_id IS NULL order by id;
CAST(my_year AS DATE) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 1901 2
+2155-00-00 2155 3
+2000-00-00 2000 4
+2005-00-00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as date) AS `CAST(my_year AS DATE)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4284,15 +4265,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 36 OR select_id IS NULL) order by id;
CAST(my_year AS DATE) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 1901 2
+2155-00-00 2155 3
+2000-00-00 2000 4
+2005-00-00 2005 5
DROP VIEW v1;
@@ -4409,14 +4385,13 @@ CAST(my_double AS DATE) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 0 4
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4427,14 +4402,13 @@ CAST(my_double AS DATE) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 0 4
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
DROP VIEW v1;
diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result
index bcef7bae827..61b375fbc1e 100644
--- a/mysql-test/suite/funcs_1/r/myisam_func_view.result
+++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result
@@ -3541,10 +3541,10 @@ my_year, id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL order by id;
CAST(my_year AS TIME) my_year id
NULL NULL 1
-00:19:01 1901 2
-00:21:55 2155 3
-00:20:00 2000 4
-00:20:05 2005 5
+00:00:00 1901 2
+00:00:00 2155 3
+00:00:00 2000 4
+00:00:00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as time) AS `CAST(my_year AS TIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3553,10 +3553,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 58 OR select_id IS NULL) order by id;
CAST(my_year AS TIME) my_year id
NULL NULL 1
-00:19:01 1901 2
-00:21:55 2155 3
-00:20:00 2000 4
-00:20:05 2005 5
+00:00:00 1901 2
+00:00:00 2155 3
+00:00:00 2000 4
+00:00:00 2005 5
DROP VIEW v1;
@@ -3677,8 +3677,8 @@ NULL 1.7976931348623e+308 3
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308'
-Warning 1292 Truncated incorrect time value: '1.7976931348623e+308'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3693,8 +3693,8 @@ NULL 1.7976931348623e+308 3
-00:00:01 -1 5
00:17:58 1758 25
Warnings:
-Warning 1292 Truncated incorrect time value: '-1.7976931348623e+308'
-Warning 1292 Truncated incorrect time value: '1.7976931348623e+308'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
DROP VIEW v1;
@@ -3887,15 +3887,10 @@ my_year, id FROM t1_values
WHERE select_id = 47 OR select_id IS NULL order by id;
CAST(my_year AS DATETIME) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 00:00:00 1901 2
+2155-00-00 00:00:00 2155 3
+2000-00-00 00:00:00 2000 4
+2005-00-00 00:00:00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as datetime) AS `CAST(my_year AS DATETIME)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3904,15 +3899,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 47 OR select_id IS NULL) order by id;
CAST(my_year AS DATETIME) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 00:00:00 1901 2
+2155-00-00 00:00:00 2155 3
+2000-00-00 00:00:00 2000 4
+2005-00-00 00:00:00 2005 5
DROP VIEW v1;
@@ -3924,12 +3914,11 @@ WHERE select_id = 46 OR select_id IS NULL order by id;
CAST(my_time AS DATETIME) my_time id
NULL NULL 1
NULL -838:59:59 2
-NULL 838:59:59 3
+0000-01-03 22:59:59 838:59:59 3
0000-00-00 13:00:00 13:00:00 4
0000-00-00 10:00:00 10:00:00 5
Warnings:
Warning 1292 Truncated incorrect datetime value: '-838:59:59'
-Warning 1292 Truncated incorrect datetime value: '838:59:59'
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_time` as datetime) AS `CAST(my_time AS DATETIME)`,`t1_values`.`my_time` AS `my_time`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3939,12 +3928,11 @@ WHERE select_id = 46 OR select_id IS NULL) order by id;
CAST(my_time AS DATETIME) my_time id
NULL NULL 1
NULL -838:59:59 2
-NULL 838:59:59 3
+0000-01-03 22:59:59 838:59:59 3
0000-00-00 13:00:00 13:00:00 4
0000-00-00 10:00:00 10:00:00 5
Warnings:
Warning 1292 Truncated incorrect datetime value: '-838:59:59'
-Warning 1292 Truncated incorrect datetime value: '838:59:59'
DROP VIEW v1;
@@ -4035,15 +4023,14 @@ CAST(my_double AS DATETIME) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 00:00:00 0 4
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
-Warning 1292 Incorrect datetime value: '200506271758'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
+Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 6
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4054,15 +4041,14 @@ CAST(my_double AS DATETIME) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 00:00:00 0 4
NULL -1 5
NULL 200506271758 19
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
-Warning 1292 Incorrect datetime value: '200506271758'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 1
DROP VIEW v1;
@@ -4267,15 +4253,10 @@ my_year, id FROM t1_values
WHERE select_id = 36 OR select_id IS NULL order by id;
CAST(my_year AS DATE) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 1901 2
+2155-00-00 2155 3
+2000-00-00 2000 4
+2005-00-00 2005 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_year` as date) AS `CAST(my_year AS DATE)`,`t1_values`.`my_year` AS `my_year`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4284,15 +4265,10 @@ WHERE v1.id IN (SELECT id FROM t1_values
WHERE select_id = 36 OR select_id IS NULL) order by id;
CAST(my_year AS DATE) my_year id
NULL NULL 1
-NULL 1901 2
-NULL 2155 3
-NULL 2000 4
-NULL 2005 5
-Warnings:
-Warning 1292 Incorrect datetime value: '1901'
-Warning 1292 Incorrect datetime value: '2155'
-Warning 1292 Incorrect datetime value: '2000'
-Warning 1292 Incorrect datetime value: '2005'
+1901-00-00 1901 2
+2155-00-00 2155 3
+2000-00-00 2000 4
+2005-00-00 2005 5
DROP VIEW v1;
@@ -4409,14 +4385,13 @@ CAST(my_double AS DATE) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 0 4
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 2
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 3
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -4427,14 +4402,13 @@ CAST(my_double AS DATE) my_double id
NULL NULL 1
NULL -1.7976931348623e+308 2
NULL 1.7976931348623e+308 3
-NULL 0 4
+0000-00-00 0 4
NULL -1 5
2005-06-27 20050627 13
Warnings:
-Warning 1292 Incorrect datetime value: '-1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '1.7976931348623e+308'
-Warning 1292 Incorrect datetime value: '0'
-Warning 1292 Incorrect datetime value: '-1'
+Warning 1292 Incorrect datetime value: '-1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '1.7976931348623e+308' for column 'my_double' at row 1
+Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1
DROP VIEW v1;
diff --git a/mysql-test/suite/pbxt/r/func_sapdb.result b/mysql-test/suite/pbxt/r/func_sapdb.result
index 4c3769cb52e..9e8775c876a 100644
--- a/mysql-test/suite/pbxt/r/func_sapdb.result
+++ b/mysql-test/suite/pbxt/r/func_sapdb.result
@@ -196,7 +196,7 @@ f8 date YES NULL
f9 time(6) YES NULL
select * from t1;
f1 f2 f3 f4 f5 f6 f7 f8 f9
-1997-01-01 1998-01-02 01:01:00.000003 49:01:01.000001 46:58:57.999999 -24:00:00.000001 10:11:12 2001-12-01 01:01:01.000000 1997-12-31 23:59:59.000001
+1997-01-01 1998-01-02 01:01:00.000002 49:01:00.000002 46:58:57.999999 -24:00:00.000001 10:11:12 2001-12-01 01:01:01.000000 1997-12-31 23:59:59.000001
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
insert into test values
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
@@ -241,6 +241,8 @@ a
select microsecond(19971231235959.01) as a;
a
10000
+Warnings:
+Warning 1292 Truncated incorrect time value: '19971231235959.01'
select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a;
a
1997-12-31 00:00:10.090000
diff --git a/mysql-test/suite/pbxt/r/func_timestamp.result b/mysql-test/suite/pbxt/r/func_timestamp.result
index 495fedea9e6..18fcbd947e7 100644
--- a/mysql-test/suite/pbxt/r/func_timestamp.result
+++ b/mysql-test/suite/pbxt/r/func_timestamp.result
@@ -7,7 +7,7 @@ SELECT CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit) AS Date,
UNIX_TIMESTAMP(CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit)) AS Unix
FROM t1;
Date Unix
-1998-9-16 09:26:00 905927160
-1998-9-16 09:26:00 905927160
+1998-9-16 09:26:00 905927160.000000
+1998-9-16 09:26:00 905927160.000000
drop table t1;
set time_zone= @@global.time_zone;
diff --git a/mysql-test/suite/pbxt/r/range.result b/mysql-test/suite/pbxt/r/range.result
index 142ea2a0d70..7d2d17bdc1e 100644
--- a/mysql-test/suite/pbxt/r/range.result
+++ b/mysql-test/suite/pbxt/r/range.result
@@ -923,13 +923,10 @@ INSERT INTO t1 VALUES
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref PRIMARY PRIMARY 20 const 2 Using index condition
-Warnings:
-Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
item started price
Warnings:
-Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 1
-Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 0
+Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00'
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
item started price
A1 2005-11-01 08:00:00 1000.000
@@ -941,7 +938,7 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
item started price
Warnings:
-Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' for column 'started' at row 0
+Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00'
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
item started price
A1 2005-11-01 08:00:00 1000.000
diff --git a/mysql-test/suite/pbxt/r/select.result b/mysql-test/suite/pbxt/r/select.result
index 06c84f8a224..51e5d95edea 100644
--- a/mysql-test/suite/pbxt/r/select.result
+++ b/mysql-test/suite/pbxt/r/select.result
@@ -2121,8 +2121,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
gvid the_success the_fail the_size the_time
Warnings:
-Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
-Warning 1292 Incorrect datetime value: 'wrong-date-value' for column 'sampletime' at row 0
+Warning 1292 Incorrect datetime value: 'wrong-date-value'
+Warning 1292 Incorrect datetime value: 'wrong-date-value'
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
gvid the_success the_fail the_size the_time
DROP TABLE t1,t2;
@@ -3265,7 +3265,7 @@ f1 f2
4 2005-10-01
5 2005-12-30
Warnings:
-Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 0
+Warning 1292 Truncated incorrect date value: '2005-09-3a'
select * from t1 where f2 <= '2005-09-31';
f1 f2
1 2005-01-01
@@ -3276,7 +3276,7 @@ f1 f2
1 2005-01-01
2 2005-09-01
Warnings:
-Warning 1292 Incorrect date value: '2005-09-3a' for column 'f2' at row 0
+Warning 1292 Truncated incorrect date value: '2005-09-3a'
drop table t1;
create table t1 (f1 int, f2 int);
insert into t1 values (1, 30), (2, 20), (3, 10);
diff --git a/mysql-test/suite/pbxt/r/type_datetime.result b/mysql-test/suite/pbxt/r/type_datetime.result
index 65cd0e2b13b..255e8c33735 100644
--- a/mysql-test/suite/pbxt/r/type_datetime.result
+++ b/mysql-test/suite/pbxt/r/type_datetime.result
@@ -191,4 +191,4 @@ CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMA
20060810101112.000014
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
+101112.000000
diff --git a/mysql-test/suite/pbxt/r/type_time.result b/mysql-test/suite/pbxt/r/type_time.result
index 90b9c7ddc58..86aef8683ce 100644
--- a/mysql-test/suite/pbxt/r/type_time.result
+++ b/mysql-test/suite/pbxt/r/type_time.result
@@ -29,8 +29,8 @@ insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:2
Warnings:
Warning 1265 Data truncated for column 't' at row 1
Warning 1265 Data truncated for column 't' at row 2
-Warning 1264 Out of range value for column 't' at row 3
-Warning 1264 Out of range value for column 't' at row 4
+Warning 1265 Data truncated for column 't' at row 3
+Warning 1265 Data truncated for column 't' at row 4
Warning 1265 Data truncated for column 't' at row 6
select * from t1;
t
@@ -55,8 +55,8 @@ t
36:30:31
00:00:10
00:00:00
-838:59:59
-838:59:59
+00:00:00
+00:00:00
262:22:00
00:00:12
drop table t1;
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index 6ae10d805db..de4d4dcbb93 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -225,10 +225,10 @@ c int(11) YES NULL VIRTUAL
d varchar(5) YES NULL PERSISTENT
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
-a int(11) NULL NO NULL select,insert,update,references
-b varchar(32) latin1_swedish_ci YES NULL select,insert,update,references
-c int(11) NULL YES NULL VIRTUAL select,insert,update,references
-d varchar(5) latin1_swedish_ci YES NULL PERSISTENT select,insert,update,references
+a int(11) NULL NO NULL #
+b varchar(32) latin1_swedish_ci YES NULL #
+c int(11) NULL YES NULL VIRTUAL #
+d varchar(5) latin1_swedish_ci YES NULL PERSISTENT #
INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,NULL);
UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a';
Warnings:
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index 68cfca32904..a0616d187da 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -195,6 +195,7 @@ CREATE TABLE `t1` (
) ENGINE=MyISAM;
show create table t1;
show columns from t1;
+--replace_column 8 #
show full columns from t1;
INSERT INTO `test`.`t1`(`a`,`b`,`c`,`d`) VALUES ( '1','a',NULL,NULL);
UPDATE `test`.`t1` SET `d`='b' WHERE `a`='1' AND `b`='a' AND `c`='1' AND `d`='a';
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index bbac69d9ac9..1d7960101a7 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1280,7 +1280,7 @@ int number_to_time(my_bool neg, longlong nr, ulong sec_part,
sec_part= TIME_MAX_SECOND_PART;
*was_cut= MYSQL_TIME_WARN_OUT_OF_RANGE;
}
- ltime->hour = nr/100/100;
+ ltime->hour = (uint)(nr/100/100);
ltime->minute= nr/100%100;
ltime->second= nr%100;
ltime->second_part= sec_part;
diff --git a/sql/field.cc b/sql/field.cc
index f6b30b4dee3..b424567f641 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4624,12 +4624,7 @@ int Field_timestamp::store(double nr)
Lazy_string_double str(nr);
THD *thd= table->in_use;
- /* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
- if (nr < 0 || nr > LONGLONG_MAX)
- nr= static_cast<double>(LONGLONG_MAX);
- longlong tmp= number_to_datetime((longlong) floor(nr),
- (nr-floor(nr))*TIME_SECOND_PART_FACTOR,
- &l_time, (thd->variables.sql_mode &
+ longlong tmp= double_to_datetime(nr, &l_time, (thd->variables.sql_mode &
MODE_NO_ZERO_DATE) |
MODE_NO_ZERO_IN_DATE, &error);
return store_TIME_with_warning(thd, &l_time, &str, error, tmp != -1);
@@ -5119,11 +5114,7 @@ int Field_temporal::store(double nr)
THD *thd= table->in_use;
Lazy_string_double str(nr);
- if (nr < 0 || nr > LONGLONG_MAX)
- nr= static_cast<double>(LONGLONG_MAX);
- longlong tmp= number_to_datetime((longlong) floor(nr),
- ((nr-floor(nr))*TIME_SECOND_PART_FACTOR),
- &ltime,
+ longlong tmp= double_to_datetime(nr, &ltime,
(TIME_FUZZY_DATE |
(thd->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE |
@@ -5231,8 +5222,8 @@ int Field_time::store(double nr)
bool neg= nr < 0;
if (neg)
nr= -nr;
- int have_smth_to_conv= !number_to_time(neg, nr,
- (nr - trunc(nr)) * TIME_SECOND_PART_FACTOR,
+ int have_smth_to_conv= !number_to_time(neg, (longlong)nr,
+ (ulong)((nr - floor(nr)) * TIME_SECOND_PART_FACTOR),
&ltime, &was_cut);
return store_TIME_with_warning(&ltime, &str, was_cut, have_smth_to_conv);
diff --git a/sql/field.h b/sql/field.h
index 535f024e2ba..02ce7a64374 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1433,7 +1433,7 @@ public:
DBUG_ASSERT(dec);
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
zero_point= sec_part_shift(
- ((TIME_MAX_VALUE_SECONDS+1)*TIME_SECOND_PART_FACTOR), dec);
+ ((TIME_MAX_VALUE_SECONDS+1LL)*TIME_SECOND_PART_FACTOR), dec);
}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
uint decimals() const { return dec; }
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 38721484bf1..afc4d8252ff 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -669,11 +669,9 @@ Copy_field::get_copy_func(Field *to,Field *from)
{
/* If types are not 100 % identical then convert trough get_date() */
if (!to->eq_def(from) ||
- (((to->table->in_use->variables.sql_mode &
- (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
- MODE_INVALID_DATES))) &&
- (to->type() == MYSQL_TYPE_DATE ||
- to->type() == MYSQL_TYPE_DATETIME)))
+ ((to->table->in_use->variables.sql_mode &
+ (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE)) &&
+ mysql_type_to_time_type(to->type()) != MYSQL_TIMESTAMP_TIME))
return do_field_temporal;
/* Do binary copy */
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c765571a318..453773478d8 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -4186,7 +4186,7 @@ bool Item_dyncol_get::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
return 0;
}
/* let double_to_datetime_with_warn() issue the warning message */
- val.double_value= ULONGLONG_MAX;
+ val.double_value= static_cast<double>(ULONGLONG_MAX);
/* fall_trough */
case DYN_COL_DOUBLE:
if (double_to_datetime_with_warn(val.double_value, ltime, fuzzy_date,
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 43d004e9b50..e7fe2095481 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -482,7 +482,7 @@ bool Item_sum::walk (Item_processor processor, bool walk_subquery,
Field *Item_sum::create_tmp_field(bool group, TABLE *table,
uint convert_blob_length)
{
- Field *field;
+ Field *UNINIT_VAR(field);
switch (result_type()) {
case REAL_RESULT:
field= new Field_double(max_length, maybe_null, name, decimals, TRUE);
diff --git a/sql/time.cc b/sql/time.cc
index f7127df3509..bd1ffdd4d0e 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -290,16 +290,16 @@ bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime,
ulong fuzzydate, const char *field_name)
{
const Lazy_string_double str(value);
- ulonglong nr;
- ulong sec_part;
bool neg= value < 0;
if (neg)
value= -value;
- nr = value > LONGLONG_MAX ? LONGLONG_MAX
- : static_cast<ulonglong>(trunc(value));
- sec_part= (ulong)((value - nr)*TIME_SECOND_PART_FACTOR);
+ if (value > LONGLONG_MAX)
+ value= static_cast<double>(LONGLONG_MAX);
+
+ longlong nr= static_cast<ulonglong>(floor(value));
+ uint sec_part= static_cast<ulong>((value - floor(value))*TIME_SECOND_PART_FACTOR);
return number_to_time_with_warn(neg, nr, sec_part, ltime, fuzzydate, &str,
field_name);
}
@@ -857,7 +857,7 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
{
if (usec > TIME_MAX_HOUR)
goto invalid_date;
- ltime->hour= usec;
+ ltime->hour= static_cast<uint>(usec);
ltime->day= 0;
return 0;
}