summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@oracle.com>2011-01-19 15:09:32 +0100
committerMartin Hansson <martin.hansson@oracle.com>2011-01-19 15:09:32 +0100
commit616e2227ccbda30d4fd7ad34beee0da00e4aa933 (patch)
treefeae43ad85767b6832ddf9e45f72a8bc880e92d1 /mysql-test/t
parentff7df1d872030c7e89dd3289f17997999e3f22d9 (diff)
downloadmariadb-git-616e2227ccbda30d4fd7ad34beee0da00e4aa933.tar.gz
Bug#59173: Failure to handle DATE(TIME) values where Year, Month or Day is
ZERO When dates are represented internally as strings, i.e. when a string constant is compared to a date value, both values are converted to long integers, ostensibly for fast comparisons. DATE typed integer values are converted to DATETIME by multiplying by 1,000,000 (each digit pair representing hour, minute and second, respectively). But the mechanism did not distuinguish cached INTEGER values, already in correct format, from newly converted strings. Fixed by marking the INTEGER cache as being of DATETIME format.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/type_datetime.test11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index d4fa6bed186..43dafc371dc 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -445,4 +445,15 @@ SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS
# show we truncate microseconds from the right
SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime) AS DECIMAL(30,7));
+--echo #
+--echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or
+--echo # Day is ZERO
+--echo #
+CREATE TABLE t1 (dt1 DATETIME);
+INSERT INTO t1 (dt1) VALUES ('0000-00-01 00:00:01');
+DELETE FROM t1 WHERE dt1 = '0000-00-01 00:00:01';
+--echo # Should be empty
+SELECT * FROM t1;
+DROP TABLE t1;
+
--echo End of 5.1 tests