Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum 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-11 20:50:13+05:00, gshchepa@stripped +4 -0
Fixed bug #29360.
The special `zero' enum value was coerced to the normal
empty string enum value during a field-to-field copy.
This bug affected CREATE ... SELECT statements and
SELECT aggregate GROUP BY enum field statements.
Also this bug made unnecessary warnings during
the execution of CREATE ... SELECT statements:
Warning 1265 Data truncated for column...
mysql-test/r/type_enum.result@stripped, 2007-07-11 20:38:49+05:00, gshchepa@stripped +14 -0
Updated test case for bug #29360.
mysql-test/r/type_ranges.result@stripped, 2007-07-11 20:38:56+05:00, gshchepa@stripped +0 -4
Updated test case for bug #29360.
mysql-test/t/type_enum.test@stripped, 2007-07-11 20:38:38+05:00, gshchepa@stripped +15 -0
Updated test case for bug #29360.
sql/field_conv.cc@stripped, 2007-07-11 20:38:25+05:00, gshchepa@stripped +11 -5
Fixed bug #29360.
The field_conv function has been modified to properly convert
the special `zero' enum value between enum fields.
diff -Nrup a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
--- a/mysql-test/r/type_enum.result 2007-07-01 04:21:33 +05:00
+++ b/mysql-test/r/type_enum.result 2007-07-11 20:38:49 +05:00
@@ -1809,3 +1809,17 @@ f1
drop table t1;
+CREATE TABLE t1 (c1 ENUM(''));
+INSERT INTO t1 (c1) VALUES (0), ('');
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+SELECT c1 + 0, COUNT(c1) FROM t1 GROUP BY c1;
+c1 + 0 COUNT(c1)
+0 1
+1 1
+CREATE TABLE t2 SELECT * FROM t1;
+SELECT c1 + 0 FROM t2;
+c1 + 0
+0
+1
+DROP TABLE t1,t2;
diff -Nrup a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result
--- a/mysql-test/r/type_ranges.result 2006-12-13 13:17:37 +04:00
+++ b/mysql-test/r/type_ranges.result 2007-07-11 20:38:56 +05:00
@@ -208,10 +208,6 @@ options flags
one one
drop table t2;
create table t2 select * from t1;
-Warnings:
-Warning 1265 Data truncated for column 'options' at row 4
-Warning 1265 Data truncated for column 'options' at row 5
-Warning 1265 Data truncated for column 'options' at row 6
update t2 set string="changed" where auto=16;
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
diff -Nrup a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
--- a/mysql-test/t/type_enum.test 2007-07-01 04:21:34 +05:00
+++ b/mysql-test/t/type_enum.test 2007-07-11 20:38:38 +05:00
@@ -182,3 +182,18 @@ create table t1(f1 set('a','b'), index(f
insert into t1 values(''),(''),('a'),('b');
select * from t1 where f1='';
drop table t1;
+
+#
+# Bug#29360: Confluence of the special 0 enum value with the normal empty string
+# value during field to field copy.
+#
+
+CREATE TABLE t1 (c1 ENUM(''));
+INSERT INTO t1 (c1) VALUES (0), ('');
+
+SELECT c1 + 0, COUNT(c1) FROM t1 GROUP BY c1;
+
+CREATE TABLE t2 SELECT * FROM t1;
+SELECT c1 + 0 FROM t2;
+
+DROP TABLE t1,t2;
diff -Nrup a/sql/field_conv.cc b/sql/field_conv.cc
--- a/sql/field_conv.cc 2007-07-01 04:22:10 +05:00
+++ b/sql/field_conv.cc 2007-07-11 20:38:25 +05:00
@@ -790,11 +790,17 @@ int field_conv(Field *to,Field *from)
blob->value.copy();
return
blob->store(blob->value.ptr(),blob->value.length(),from->charset());
}
- if ((from->result_type() == STRING_RESULT &&
- (to->result_type() == STRING_RESULT ||
- (from->real_type() != FIELD_TYPE_ENUM &&
- from->real_type() != FIELD_TYPE_SET))) ||
- to->type() == FIELD_TYPE_DECIMAL)
+ if (from->real_type() == FIELD_TYPE_ENUM &&
+ to->real_type() == FIELD_TYPE_ENUM &&
+ from->val_int() == 0)
+ {
+ ((Field_enum *)(to))->store_type(0);
+ }
+ else if ((from->result_type() == STRING_RESULT &&
+ (to->result_type() == STRING_RESULT ||
+ (from->real_type() != FIELD_TYPE_ENUM &&
+ from->real_type() != FIELD_TYPE_SET))) ||
+ to->type() == FIELD_TYPE_DECIMAL)
{
char buff[MAX_FIELD_WIDTH];
String result(buff,sizeof(buff),from->charset());
| Thread |
|---|
| • bk commit into 5.0 tree (gshchepa:1.2527) BUG#29360 | gshchepa | 11 Jul |