List:Commits« Previous MessageNext Message »
From:eugene Date:May 30 2007 7:28pm
Subject:bk commit into 5.0 tree (evgen:1.2511) BUG#28729
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-05-30 23:28:14+04:00, evgen@stripped +3 -0
  Bug#28729: Field_enum wrongly reported an error while storing an empty string.
  
  ENUM fields internally store their values as integers and may use integer
  values as indexes to their values. Invalid values are mapped to zero value.
  When storing an empty string the ENUM field fails to find an appropriate value
  and tries to convert the provided string to integer. The conversion also
  fails and error is returned even if the thd->count_cuted_fields is set to
  CHECK_FIELD_IGNORE. This makes the range optimizer wrongly decide that an
  impossible range is present.
  
  Now the Field_enum::store() returns error while storing an empty string only
  if the thd->count_cuted_fields isn't set to CHECK_FIELD_IGNORE.

  mysql-test/r/type_enum.result@stripped, 2007-05-30 23:27:52+04:00, evgen@stripped +7 -0
    Added a test case for the bug#28729: Field_enum wrongly reported an error
    while storing an empty string.

  mysql-test/t/type_enum.test@stripped, 2007-05-30 23:28:00+04:00, evgen@stripped +8 -0
    Added a test case for the bug#28729: Field_enum wrongly reported an error
    while storing an empty string.

  sql/field.cc@stripped, 2007-05-30 23:27:51+04:00, evgen@stripped +2 -0
    Bug#28729: Field_enum wrongly reported an error while storing an empty string.
    Now the Field_enum::store() returns error while storing an empty string only
    if the thd->count_cuted_fields isn't set to CHECK_FIELD_IGNORE.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/mnt/gentoo64/work/28729-bug-5.0-opt-mysql

--- 1.349/sql/field.cc	2007-05-18 00:17:44 +04:00
+++ 1.350/sql/field.cc	2007-05-30 23:27:51 +04:00
@@ -7643,6 +7643,8 @@ int Field_enum::store(const char *from,u
 	tmp=0;
 	set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
       }
+      if (!table->in_use->count_cuted_fields)
+        err= 0;
     }
     else
       set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);

--- 1.29/mysql-test/r/type_enum.result	2007-02-12 16:32:03 +03:00
+++ 1.30/mysql-test/r/type_enum.result	2007-05-30 23:27:52 +04:00
@@ -1779,3 +1779,10 @@ create table t1(exhausting_charset enum(
 ERROR 42000: Field separator argument is not what is expected; check the manual
 End of 4.1 tests
+create table t1(f1 set('a','b'), index(f1));
+insert into t1 values(''),(''),('a'),('b');
+select * from t1 where f1='';
+f1
+
+
+drop table t1;

--- 1.17/mysql-test/t/type_enum.test	2007-02-12 16:31:43 +03:00
+++ 1.18/mysql-test/t/type_enum.test	2007-05-30 23:28:00 +04:00
@@ -157,3 +157,11 @@ create table t1(exhausting_charset enum(
 
 --echo End of 4.1 tests
+
+#
+# Bug#28729: Field_enum wrongly reported an error while storing an empty string.
+#
+create table t1(f1 set('a','b'), index(f1));
+insert into t1 values(''),(''),('a'),('b');
+select * from t1 where f1='';
+drop table t1;
Thread
bk commit into 5.0 tree (evgen:1.2511) BUG#28729eugene30 May