summaryrefslogtreecommitdiff
path: root/mysql-test/t/date_formats.test
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2003-11-26 17:06:24 +0100
committerunknown <guilhem@mysql.com>2003-11-26 17:06:24 +0100
commit0b0a79e3718f2c78fea4a4122c0bfc406feb54c4 (patch)
treec88c787bab5b75c12ee8949f2ba3f48dcb9f982c /mysql-test/t/date_formats.test
parente503dc2850de9ca1edad5169eca09ee437a3354d (diff)
downloadmariadb-git-0b0a79e3718f2c78fea4a4122c0bfc406feb54c4.tar.gz
Fix for BUG#1960 "date_format() returns spurious '-' for valid dates".
It was a forgotten ltime->neg=0 (neg was the only forgotten variable). I scanned field.cc for other places where we would forget to set neg, found none. A test for the bug. mysql-test/r/date_formats.result: result update mysql-test/t/date_formats.test: a test for BUG#1960 "date_format() returns spurious '-' for valid dates" sql/field.cc: When preparing ltime from the 3-byte date, don't forget to set ltime->neg to 0 (otherwise it remains unitialized). Dates are not allowed to be negative (only times can be, when they mean a time interval), so it's ok to always set neg to 0.
Diffstat (limited to 'mysql-test/t/date_formats.test')
-rw-r--r--mysql-test/t/date_formats.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index d9219d3ac2e..7b88c0ecf72 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -200,3 +200,12 @@ select get_format(DATE, 'TEST') as a;
select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
+
+#
+# Test of date_format()
+#
+
+create table t1 (d date);
+insert into t1 values ('2004-07-14'),('2005-07-14');
+select date_format(d,"%d") from t1 order by 1;
+drop table t1;