diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 1ada270b3265d483d252e198ccfb31f3cbbb5156..039640a5036325b7dc04c9d1cef3c693051f0466 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1527,3 +1527,9 @@ NULL
 Warnings:
 Warning	1292	Incorrect datetime value: '0000-00-00'
 drop table t1;
+create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp);
+insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00');
+select least(greatest(f3, f2, f4), f5) from t1;
+least(greatest(f3, f2, f4), f5)
+0000-00-00 00:00:00
+drop table t1;
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 078f910a7044b37c3a0b5a8823d3c8922805a726..7d143ed9c167bd4d07913f0934b0914ffd53b18d 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -960,3 +960,11 @@ select timestampadd(week, 1, f1) from t1;
 select timestampadd(week, 1, date("0000-00-00"));
 drop table t1;
 
+#
+# lp:737450 Second Assertion `item->null_value' failed in 5.1-micro
+#
+create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp);
+insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00');
+select least(greatest(f3, f2, f4), f5) from t1;
+drop table t1;
+
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 821341aa82deb584fbcd520ff49d920779244f5d..3e539585dde6a25cb2fa2ec2f08abd72ee9688e5 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2259,9 +2259,6 @@ void Item_func_min_max::fix_length_and_dec()
 /*
   Compare item arguments in the DATETIME context.
 
-  SYNOPSIS
-    cmp_datetimes()
-
   DESCRIPTION
     Compare item arguments as DATETIME values and return the index of the
     least/greatest argument in the arguments array.
@@ -2273,9 +2270,10 @@ void Item_func_min_max::fix_length_and_dec()
    0    Otherwise
 */
 
-bool Item_func_min_max::cmp_datetimes(MYSQL_TIME *ltime)
+bool Item_func_min_max::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
 {
   longlong UNINIT_VAR(min_max);
+  DBUG_ASSERT(fixed == 1);
 
   for (uint i=0; i < arg_count ; i++)
   {
@@ -2309,7 +2307,7 @@ String *Item_func_min_max::val_str(String *str)
   if (compare_as_dates)
   {
     MYSQL_TIME ltime;
-    if (cmp_datetimes(&ltime))
+    if (get_date(&ltime, TIME_FUZZY_DATE))
       return 0;
 
     char buf[MAX_DATE_STRING_REP_LENGTH];
@@ -2383,7 +2381,7 @@ double Item_func_min_max::val_real()
   if (compare_as_dates)
   {
     MYSQL_TIME ltime;
-    if (cmp_datetimes(&ltime))
+    if (get_date(&ltime, TIME_FUZZY_DATE))
       return 0;
 
     return TIME_to_double(&ltime);
@@ -2412,7 +2410,7 @@ longlong Item_func_min_max::val_int()
   if (compare_as_dates)
   {
     MYSQL_TIME ltime;
-    if (cmp_datetimes(&ltime))
+    if (get_date(&ltime, TIME_FUZZY_DATE))
       return 0;
 
     return TIME_to_ulonglong(&ltime);
@@ -2442,7 +2440,7 @@ my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
   if (compare_as_dates)
   {
     MYSQL_TIME ltime;
-    if (cmp_datetimes(&ltime))
+    if (get_date(&ltime, TIME_FUZZY_DATE))
       return 0;
 
     return date2my_decimal(&ltime, dec);
diff --git a/sql/item_func.h b/sql/item_func.h
index d0f5d8d8d8fb0ff459ec7bc3a4a69f544cd7e593..cd2829fb5a760bcfae31409556cc706b491e4209 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -769,9 +769,9 @@ public:
   longlong val_int();
   String *val_str(String *);
   my_decimal *val_decimal(my_decimal *);
+  bool get_date(MYSQL_TIME *res, uint fuzzy_date);
   void fix_length_and_dec();
   enum Item_result result_type () const { return cmp_type; }
-  bool cmp_datetimes(MYSQL_TIME *ltime);
   enum_field_types field_type() const { return cached_field_type; }
 };