From 6d55b423d8ae570e958d4926342af9e9ba34a117 Mon Sep 17 00:00:00 2001
From: "SergeyV@selena." <>
Date: Wed, 28 Dec 2005 19:40:37 +0300
Subject: [PATCH] Fixes bug #15634. Eliminates compiler warning 'all return
 paths are recursive in Field_date::store function'. Though the
 Field_date::store function almost unused when protocol_version=10 additional
 check was added into it to store 4byte dates properly. Effective test routine
 is not available so far due to protocol_version is not a dynamic property and
 can not be modified with mysql-test script.

---
 sql/field.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sql/field.cc b/sql/field.cc
index 8f9dc832520..f60abacfbac 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5242,7 +5242,7 @@ int Field_date::store(double nr)
   else
     tmp= (longlong) rint(nr);
 
-  return Field_date::store(tmp);
+  return Field_date::store(tmp, TRUE);
 }
 
 
@@ -5264,6 +5264,9 @@ int Field_date::store(longlong nr, bool unsigned_val)
     error= 2;
   }
 
+  if (nr >= 19000000000000.0 && nr <= 99991231235959.0)
+    nr=floor(nr/1000000.0);			// Timestamp to date
+
   if (error)
     set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
                          error == 2 ? ER_WARN_DATA_OUT_OF_RANGE :
-- 
2.30.9