Commit e1d9a237 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14023 10.1 InnoDB tables with virtual columns cannot be accessed in 10.2

MariaDB 10.1 introduced non-indexed virtual columns for InnoDB tables.
When MySQL 5.7 introduced virtual columns in InnoDB tables, it also
introduced the table SYS_VIRTUAL that stores metadata on virtual
columns. This table does not initially exist in data files that were
imported from 10.1. So, we do not always have virtual column metadata
inside InnoDB.

dict_index_contains_col_or_prefix(): In the clustered index records,
all non-virtual columns are present and no virtual columns are present.

ha_innobase::build_template(): In the clustered index, do not
include virtual columns in the query template. The SQL layer is
supposed to compute the virtual column values when needed.
parent 3edd007c
......@@ -912,8 +912,7 @@ dict_index_contains_col_or_prefix(
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
if (dict_index_is_clust(index)) {
return(TRUE);
return(!is_virtual);
}
if (is_virtual) {
......
......@@ -8204,13 +8204,16 @@ ha_innobase::build_template(
} else {
ibool contain;
if (innobase_is_v_fld(table->field[i])) {
contain = dict_index_contains_col_or_prefix(
index, num_v, true);
} else {
if (!innobase_is_v_fld(table->field[i])) {
contain = dict_index_contains_col_or_prefix(
index, i - num_v,
false);
} else if (dict_index_is_clust(index)) {
num_v++;
continue;
} else {
contain = dict_index_contains_col_or_prefix(
index, num_v, true);
}
field = build_template_needs_field(
......
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