summaryrefslogtreecommitdiff
path: root/mysql-test/t/cast.test
diff options
context:
space:
mode:
authorunknown <tnurnberg@white.intern.koehntopp.de>2007-11-10 03:11:18 +0100
committerunknown <tnurnberg@white.intern.koehntopp.de>2007-11-10 03:11:18 +0100
commit3e90d4185098e077780569248a1151648bd5f188 (patch)
tree31f7387dc6e20a18054fe00a73b3bed58ad0b4bf /mysql-test/t/cast.test
parentf97b8e48b8f6ec290f7cc7ca3fe59c33f7cb0d9e (diff)
parentb1fc4b9e639ab6913df49bbd8c01103eaf14c81d (diff)
downloadmariadb-git-3e90d4185098e077780569248a1151648bd5f188.tar.gz
Merge mysql.com:/misc/mysql/31990/50-31990
into mysql.com:/misc/mysql/31990/51-31990 mysql-test/r/cast.result: Auto merged mysql-test/t/cast.test: Auto merged sql/item_timefunc.cc: Auto merged sql/item_timefunc.h: Auto merged
Diffstat (limited to 'mysql-test/t/cast.test')
-rw-r--r--mysql-test/t/cast.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 5563e260a06..50865215944 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -246,4 +246,26 @@ INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
SELECT cast(date(d1) as signed) FROM t1;
drop table t1;
+#
+# Bug #31990: MINUTE() and SECOND() return bogus results when used on a DATE
+#
+
+# Show that HH:MM:SS of a DATE are 0, and that it's the same for columns
+# and typecasts (NULL in, NULL out).
+CREATE TABLE t1 (f1 DATE);
+INSERT INTO t1 VALUES ('2007-07-19'), (NULL);
+SELECT HOUR(f1),
+ MINUTE(f1),
+ SECOND(f1) FROM t1;
+SELECT HOUR(CAST('2007-07-19' AS DATE)),
+ MINUTE(CAST('2007-07-19' AS DATE)),
+ SECOND(CAST('2007-07-19' AS DATE));
+SELECT HOUR(CAST(NULL AS DATE)),
+ MINUTE(CAST(NULL AS DATE)),
+ SECOND(CAST(NULL AS DATE));
+SELECT HOUR(NULL),
+ MINUTE(NULL),
+ SECOND(NULL);
+DROP TABLE t1;
+
--echo End of 5.0 tests