summaryrefslogtreecommitdiff
path: root/mysql-test/t/type_datetime.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/type_datetime.test')
-rw-r--r--mysql-test/t/type_datetime.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index eb1b7bde844..d4fa6bed186 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -427,3 +427,22 @@ create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '196
--error 1067
create table t1 (t time default '916:00:00 a');
set @@sql_mode= @org_mode;
+
+#
+# Bug #42146 - DATETIME fractional seconds parse error
+#
+# show we trucate microseconds from the right -- special case: leftmost is 0
+SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME) AS DECIMAL(30,7));
+
+# show that we ignore leading zeroes for all other fields
+SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME) AS DECIMAL(30,7));
+# once more with feeling (but no warnings)
+SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME) AS DECIMAL(30,7));
+
+#
+# Bug #38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE
+#
+# show we truncate microseconds from the right
+SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7));
+
+--echo End of 5.1 tests