From eddd02158b065e3cecbbb6dc2ebeb4c6367f02d3 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Tue, 8 May 2007 00:08:00 +0400 Subject: [PATCH] Additional fix for the bug#27759: Wrong DATE/DATETIME comparison in LEAST()/GREATEST() functions. --- mysql-test/t/type_datetime.test | 2 ++ sql/item_func.h | 1 + 2 files changed, 3 insertions(+) diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index d0fcf9c57de..5eb9d317a8c 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -206,6 +206,8 @@ select greatest(cast('01-01-01' as date), '01-01-02'); select least(cast('01-01-01' as date), '01-01-02') + 0; select greatest(cast('01-01-01' as date), '01-01-02') + 0; select least(cast('01-01-01' as datetime), '01-01-02') + 0; +select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); +select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal); --disable_warnings DROP PROCEDURE IF EXISTS test27759 ; --enable_warnings diff --git a/sql/item_func.h b/sql/item_func.h index 952c828b251..0443e394585 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -703,6 +703,7 @@ public: my_decimal *val_decimal(my_decimal *); void fix_length_and_dec(); enum Item_result result_type () const { return cmp_type; } + bool result_as_longlong() { return compare_as_dates; }; uint cmp_datetimes(ulonglong *value); };