MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:July 14 2007 6:44pm
Subject:bk commit into 5.0 tree (evgen:1.2527) BUG#29729
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-07-14 22:43:58+04:00, evgen@stripped +3 -0
  Bug#29729: Wrong conversion error led to an empty result set.
  
  The Field_newdate::store when storing a DATETIME value was returning the
  'value was cut' error even if the thd->count_cuted_fields flag is set to
  CHECK_FIELD_IGNORE. This made range optimizr think that there is no
  appropriate data in the table and thus to return an empty set.
  
  Now the Field_newdate::store function returns conversion error only if the
  thd->count_cuted_fields flag isn't set to CHECK_FIELD_IGNORE.

  mysql-test/r/type_time.result@stripped, 2007-07-14 22:43:52+04:00, evgen@stripped +13 -0
    Added a test case for the bug#29729: Wrong conversion error led to an empty result set.

  mysql-test/t/type_time.test@stripped, 2007-07-14 22:43:49+04:00, evgen@stripped +15 -0
    Added a test case for the bug#29729: Wrong conversion error led to an empty result set.

  sql/field.cc@stripped, 2007-07-14 22:43:53+04:00, evgen@stripped +2 -1
    Bug#29729: Wrong conversion error led to an empty result set.

diff -Nrup a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
--- a/mysql-test/r/type_time.result	2007-07-12 23:07:49 +04:00
+++ b/mysql-test/r/type_time.result	2007-07-14 22:43:52 +04:00
@@ -109,3 +109,16 @@ select 1 from t1 where cast('100:00:00' 
 1
 1
 drop table t1;
+CREATE TABLE  t1 (
+f2 date NOT NULL,
+f3 int(11) unsigned NOT NULL default '0',
+PRIMARY KEY  (f3, f2)
+);
+insert into t1 values('2007-07-01', 1);
+insert into t1 values('2007-07-01', 2);
+insert into t1 values('2007-07-02', 1);
+insert into t1 values('2007-07-02', 2);
+SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
+sum(f3)
+3
+drop table t1;
diff -Nrup a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
--- a/mysql-test/t/type_time.test	2007-07-12 23:07:34 +04:00
+++ b/mysql-test/t/type_time.test	2007-07-14 22:43:49 +04:00
@@ -58,3 +58,18 @@ create table t1(f1 time, f2 time);
 insert into t1 values('20:00:00','150:00:00');
 select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
 drop table t1;
+
+#
+# Bug#29729: Wrong conversion error led to an empty result set.
+#
+CREATE TABLE  t1 (
+  f2 date NOT NULL,
+  f3 int(11) unsigned NOT NULL default '0',
+  PRIMARY KEY  (f3, f2)
+);
+insert into t1 values('2007-07-01', 1);
+insert into t1 values('2007-07-01', 2);
+insert into t1 values('2007-07-02', 1);
+insert into t1 values('2007-07-02', 2);
+SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
+drop table t1;
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc	2007-07-07 23:31:48 +04:00
+++ b/sql/field.cc	2007-07-14 22:43:53 +04:00
@@ -5271,7 +5271,8 @@ int Field_newdate::store(const char *fro
   else
   {
     tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
-    if (!error && (ret != MYSQL_TIMESTAMP_DATE))
+    if (!error && (ret != MYSQL_TIMESTAMP_DATE) &&
+        thd->count_cuted_fields != CHECK_FIELD_IGNORE)
       error= 3;                                 // Datetime was cut (note)
   }
 
Thread
bk commit into 5.0 tree (evgen:1.2527) BUG#29729eugene14 Jul