1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-20589: Server still crashes in Field::set_warning_truncated_wrong_value

The flag is_stat_field is not set for the min_value and max_value of field items
inside table share. This is a must requirement as we don't want to throw
warnings of truncation when we read values from the statistics table to the column
statistics of table share fields.
This commit is contained in:
Varun Gupta
2019-09-18 01:59:29 +05:30
parent c471bfb34e
commit 273d8eb12c
6 changed files with 73 additions and 14 deletions

View File

@ -1153,12 +1153,14 @@ public:
case COLUMN_STAT_MIN_VALUE:
table_field->read_stats->min_value->set_notnull();
stat_field->val_str(&val);
DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field);
table_field->read_stats->min_value->store(val.ptr(), val.length(),
&my_charset_bin);
break;
case COLUMN_STAT_MAX_VALUE:
table_field->read_stats->max_value->set_notnull();
stat_field->val_str(&val);
DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field);
table_field->read_stats->max_value->store(val.ptr(), val.length(),
&my_charset_bin);
break;
@ -2045,7 +2047,7 @@ void create_min_max_statistical_fields_for_table_share(THD *thd,
Field *fld;
Field *table_field= *field_ptr;
my_ptrdiff_t diff= record - table_share->default_values;
if (!(fld= table_field->clone(&stats_cb->mem_root, diff)))
if (!(fld= table_field->clone(&stats_cb->mem_root, NULL, diff, TRUE)))
continue;
if (i == 0)
table_field->read_stats->min_value= fld;