summaryrefslogtreecommitdiff
path: root/mysql-test/t/type_date.test
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-21 08:01:00 +0400
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-11-21 08:01:00 +0400
commitf2a631f0dcd87d6d53ae0293bfb70364ca30dc4d (patch)
treecd48c8b1187ac8681709e99b0a327f08c93e7009 /mysql-test/t/type_date.test
parentcaa031e0f76c769f044d39c4f244c8fbee71c3f0 (diff)
downloadmariadb-git-f2a631f0dcd87d6d53ae0293bfb70364ca30dc4d.tar.gz
Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result
Problem: caching 00000000-00000099 dates as integer values we're improperly shifting them up twice in the get_datetime_value(). Fix: don't shift cached DATETIME values up for the second time. mysql-test/r/type_date.result: Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result - test result. mysql-test/t/type_date.test: Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result - test case. sql/item.h: Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result - Item_cache::field_type() method added. - new Item_cache(enum_field_types) and Item_cache_int(enum_field_types) constructors added. sql/item_cmpfunc.cc: Fix for bug #32021: Using Date 000-00-01 in WHERE causes wrong result - don't shift cached DATETIME values for the second time in the get_datetime_value(): creating new Item_cache_int set DATETIME filed type, check the type before shifting.
Diffstat (limited to 'mysql-test/t/type_date.test')
-rw-r--r--mysql-test/t/type_date.test10
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index b21f21d2f3d..14854406eb8 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -194,3 +194,13 @@ SET SQL_MODE=DEFAULT;
DROP TABLE t1,t2;
--echo End of 5.0 tests
+
+#
+# Bug#32021: Using Date 000-00-01 in WHERE causes wrong result
+#
+create table t1 (a date, primary key (a))engine=memory;
+insert into t1 values ('0000-01-01'), ('0000-00-01'), ('0001-01-01');
+select * from t1 where a between '0000-00-01' and '0000-00-02';
+drop table t1;
+
+--echo End of 5.1 tests