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
1.1988 05/08/16 22:13:43 evgen@stripped +3 -0
Fix bug #11398 Bug in field_conv() results in wrong result of join with index
When copying varchar fields with field_conv() it's not taken into account
that length_bytes of source and destination fields may be different.
This results in saving wrong data in field and making wrong key later.
Added check so if fields are varchar and have different length_bytes they
are not copied by memcpy().
mysql-test/r/select.result
1.77 05/08/16 22:12:16 evgen@stripped +9 -0
Test case for bug #11398 Bug in field_conv() results in wrong result of join with
index
mysql-test/t/select.test
1.63 05/08/16 22:12:05 evgen@stripped +10 -0
Test case for bug #11398 Bug in field_conv() results in wrong result of join with
index
sql/field_conv.cc
1.50 05/08/16 22:09:44 evgen@stripped +4 -1
Fix bug #11398 Bug in field_conv() results in wrong result of join with index
# 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: /work/11398-bug-5.0-mysql
--- 1.49/sql/field_conv.cc 2005-07-20 03:32:34 +04:00
+++ 1.50/sql/field_conv.cc 2005-08-16 22:09:44 +04:00
@@ -640,7 +640,10 @@
(!(to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) ||
to->type() != FIELD_TYPE_DATE &&
- to->type() != FIELD_TYPE_DATETIME))
+ to->type() != FIELD_TYPE_DATETIME) &&
+ (from->real_type() != MYSQL_TYPE_VARCHAR ||
+ ((Field_varstring*)from)->length_bytes ==
+ ((Field_varstring*)to)->length_bytes))
{ // Identical fields
#ifdef HAVE_purify
/* This may happen if one does 'UPDATE ... SET x=x' */
--- 1.76/mysql-test/r/select.result 2005-08-12 18:57:13 +04:00
+++ 1.77/mysql-test/r/select.result 2005-08-16 22:12:16 +04:00
@@ -2739,3 +2739,12 @@
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
16 16 2 2
+create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
+create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY
(f3,f4));
+insert into t1 values (" 2", 2);
+insert into t2 values (" 2", " one "),(" 2", " two ");
+select * from t1 left join t2 on f1 = f3;
+f1 f2 f3 f4
+ 2 2 2 one
+ 2 2 2 two
+drop table t1,t2;
--- 1.62/mysql-test/t/select.test 2005-08-12 18:57:14 +04:00
+++ 1.63/mysql-test/t/select.test 2005-08-16 22:12:05 +04:00
@@ -2350,3 +2350,13 @@
#
select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
+
+#
+# Bug #11398 Bug in field_conv() results in wrong result of join with index
+#
+create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
+create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY
(f3,f4));
+insert into t1 values (" 2", 2);
+insert into t2 values (" 2", " one "),(" 2", " two ");
+select * from t1 left join t2 on f1 = f3;
+drop table t1,t2;
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.1988) BUG#11398 | eugene | 16 Aug |