Commit afeb156b authored by marko's avatar marko

Revert r799, which was supposed to prevent similar cases as Bug #21638.

In reality, the patch breaks the handling of prefix indexes of
variable-length columns in ROW_FORMAT=COMPACT.  Reverting the patch
is only a partial fix of Bug #28138.
parent 608ee450
...@@ -1587,9 +1587,6 @@ dict_index_copy_types( ...@@ -1587,9 +1587,6 @@ dict_index_copy_types(
ifield = dict_index_get_nth_field(index, i); ifield = dict_index_get_nth_field(index, i);
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i)); dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
dict_col_copy_type(dict_field_get_col(ifield), dfield_type); dict_col_copy_type(dict_field_get_col(ifield), dfield_type);
if (UNIV_UNLIKELY(ifield->prefix_len)) {
dfield_type->len = ifield->prefix_len;
}
} }
} }
......
...@@ -142,20 +142,15 @@ row_build_index_entry( ...@@ -142,20 +142,15 @@ row_build_index_entry(
dfield_copy(dfield, dfield2); dfield_copy(dfield, dfield2);
/* If a column prefix index, take only the prefix */ /* If a column prefix index, take only the prefix */
if (ind_field->prefix_len) { if (ind_field->prefix_len > 0
if (dfield_get_len(dfield2) != UNIV_SQL_NULL) { && dfield_get_len(dfield2) != UNIV_SQL_NULL) {
storage_len = dtype_get_at_most_n_mbchars( storage_len = dtype_get_at_most_n_mbchars(
col->prtype, col->prtype, col->mbminlen, col->mbmaxlen,
col->mbminlen, col->mbmaxlen, ind_field->prefix_len,
ind_field->prefix_len, dfield_get_len(dfield2), dfield2->data);
dfield_get_len(dfield2),
dfield2->data);
dfield_set_len(dfield, storage_len);
}
dfield_get_type(dfield)->len = ind_field->prefix_len; dfield_set_len(dfield, storage_len);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment