summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-12-29 14:17:31 +0400
committerAlexander Barkov <bar@mariadb.org>2015-12-29 14:17:31 +0400
commite1b9be5417668b184893148adea5f1f0e3a8d00f (patch)
tree73a4b1035a07612863b227721e659038c3410744 /sql/field_conv.cc
parente126baafbc78f15c794082f0a93740d81041d038 (diff)
downloadmariadb-git-e1b9be5417668b184893148adea5f1f0e3a8d00f.tar.gz
MDEV-9319 ALTER from a bigger to a smaller blob type truncates too much data
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r--sql/field_conv.cc9
1 files changed, 1 insertions, 8 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index d24f31e4fa1..3fdc1639266 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -332,9 +332,7 @@ static void do_copy_next_number(Copy_field *copy)
static void do_copy_blob(Copy_field *copy)
{
- ulong length=((Field_blob*) copy->from_field)->get_length();
- ((Field_blob*) copy->to_field)->store_length(length);
- memcpy(copy->to_ptr, copy->from_ptr, sizeof(char*));
+ ((Field_blob*) copy->to_field)->copy_value(((Field_blob*) copy->from_field));
}
static void do_conv_blob(Copy_field *copy)
@@ -709,12 +707,7 @@ Copy_field::get_copy_func(Field *to,Field *from)
if (!(from->flags & BLOB_FLAG) || from->charset() != to->charset())
return do_conv_blob;
if (from_length != to_length)
- {
- // Correct pointer to point at char pointer
- to_ptr+= to_length - to->table->s->blob_ptr_size;
- from_ptr+= from_length- from->table->s->blob_ptr_size;
return do_copy_blob;
- }
}
else
{