diff options
author | unknown <evgen@moonbone.local> | 2005-08-16 22:13:43 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-08-16 22:13:43 +0400 |
commit | 06ebdbb7859ebdfa1d3ba97a45bf74224619b384 (patch) | |
tree | c660002eb3724b212902c96101d676ea79f70656 /sql/field_conv.cc | |
parent | 219c84faba28171cc04608f826703f5c031d70bc (diff) | |
download | mariadb-git-06ebdbb7859ebdfa1d3ba97a45bf74224619b384.tar.gz |
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().
sql/field_conv.cc:
Fix bug #11398 Bug in field_conv() results in wrong result of join with index
mysql-test/t/select.test:
Test case for bug #11398 Bug in field_conv() results in wrong result of join with index
mysql-test/r/select.result:
Test case for bug #11398 Bug in field_conv() results in wrong result of join with index
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r-- | sql/field_conv.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc index fc7347ef9af..40f3ff85c58 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -640,7 +640,10 @@ void field_conv(Field *to,Field *from) (!(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' */ |