From c0cb3afb06c6fbc1157281a9370a1ca11a664ba4 Mon Sep 17 00:00:00 2001 From: "ram@gw.mysql.r18.ru" <> Date: Sun, 11 Jan 2004 14:12:46 +0400 Subject: [PATCH] A fix (bug #2335: Inconsistancy with handling of Years and NOW() function). The test might fail if one runs it at 23:59:59 Dec 31 --- mysql-test/r/type_year.result | 6 ++++++ mysql-test/t/type_year.test | 9 +++++++++ sql/field.h | 1 + 3 files changed, 16 insertions(+) diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result index 25ddda88f48..5ef3c1bba81 100644 --- a/mysql-test/r/type_year.result +++ b/mysql-test/r/type_year.result @@ -26,3 +26,9 @@ y y2 2001 01 2069 69 drop table t1; +create table t1 (y year); +insert into t1 values (now()); +select if(y = now(), 1, 0) from t1; +if(y = now(), 1, 0) +1 +drop table t1; diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index 8f4f23badb4..e9e34dbc29f 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -8,3 +8,12 @@ select * from t1; select * from t1 order by y; select * from t1 order by y2; drop table t1; + +# +# Bug 2335 +# + +create table t1 (y year); +insert into t1 values (now()); +select if(y = now(), 1, 0) from t1; +drop table t1; diff --git a/sql/field.h b/sql/field.h index 8a829a455ed..413a08f08d4 100644 --- a/sql/field.h +++ b/sql/field.h @@ -600,6 +600,7 @@ public: longlong val_int(void); String *val_str(String*,String *); void sql_type(String &str) const; + bool store_for_compare() { return 1; } };