#At file:///data0/martin/bzrroot/bug59173/t/ based on revid:bar@stripped
3535 Martin Hansson 2011-01-19 [merge]
Merge of fix for Bug#59173.
modified:
mysql-test/r/type_datetime.result
mysql-test/t/type_datetime.test
sql/item_cmpfunc.cc
=== modified file 'mysql-test/r/type_datetime.result'
--- a/mysql-test/r/type_datetime.result 2010-10-21 11:34:17 +0000
+++ b/mysql-test/r/type_datetime.result 2011-01-19 14:39:13 +0000
@@ -638,6 +638,17 @@ CAST(CAST('2008-07-29T10:42:51.1234567'
20080729104251.1234560
Warnings:
Warning 1292 Truncated incorrect datetime value: '2008-07-29T10:42:51.1234567'
+#
+# Bug#59173: Failure to handle DATE(TIME) values where Year, Month or
+# Day is ZERO
+#
+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';
+# Should be empty
+SELECT * FROM t1;
+dt1
+DROP TABLE t1;
End of 5.1 tests
#
# Start of 5.5 tests
=== modified file 'mysql-test/t/type_datetime.test'
--- a/mysql-test/t/type_datetime.test 2010-10-21 11:34:17 +0000
+++ b/mysql-test/t/type_datetime.test 2011-01-19 14:39:13 +0000
@@ -451,6 +451,17 @@ SELECT CAST(CAST('00000002006-000008-000
# 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
--echo #
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2011-01-14 09:29:11 +0000
+++ b/sql/item_cmpfunc.cc 2011-01-19 14:39:13 +0000
@@ -918,7 +918,7 @@ int Arg_comparator::set_cmp_func(Item_re
cache_converted_constant can't be used here because it can't
correctly convert a DATETIME value from string to int representation.
*/
- Item_cache_int *cache= new Item_cache_int();
+ Item_cache_int *cache= new Item_cache_int(MYSQL_TYPE_DATETIME);
/* Mark the cache as non-const to prevent re-caching. */
cache->set_used_tables(1);
if (!(*a)->is_datetime())
Attachment: [text/bzr-bundle] bzr/martin.hansson@oracle.com-20110119143913-7ctrb0tgk43csqwa.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (martin.hansson:3535) Bug#59173 | Martin Hansson | 19 Jan |