summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-03-29 19:40:56 +0100
committerSergei Golubchik <serg@mariadb.org>2019-03-29 19:41:41 +0100
commit4e1d3f83b79cd5f3a920937b462e585fdfb5a35d (patch)
tree07e099b50109bd09ff8a5267c5cb5e0bf89597b4 /sql/sql_statistics.cc
parenta82cfe109cbc033253ddaba82f9c2de663601002 (diff)
parentcc71e7501cb623b2d600c47dbe10a31dcf6e8fcf (diff)
downloadmariadb-git-4e1d3f83b79cd5f3a920937b462e585fdfb5a35d.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 2384c68115b..11fd7765e03 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -1058,7 +1058,9 @@ public:
else
{
table_field->collected_stats->min_value->val_str(&val);
- stat_field->store(val.ptr(), val.length(), &my_charset_bin);
+ size_t length= Well_formed_prefix(val.charset(), val.ptr(),
+ MY_MIN(val.length(), stat_field->field_length)).length();
+ stat_field->store(val.ptr(), length, &my_charset_bin);
}
break;
case COLUMN_STAT_MAX_VALUE:
@@ -1067,7 +1069,9 @@ public:
else
{
table_field->collected_stats->max_value->val_str(&val);
- stat_field->store(val.ptr(), val.length(), &my_charset_bin);
+ size_t length= Well_formed_prefix(val.charset(), val.ptr(),
+ MY_MIN(val.length(), stat_field->field_length)).length();
+ stat_field->store(val.ptr(), length, &my_charset_bin);
}
break;
case COLUMN_STAT_NULLS_RATIO:
@@ -3053,7 +3057,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
}
}
}
-
+
table->stats_is_read= TRUE;
DBUG_RETURN(0);