mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
MDEV-26220 Server crashes with indexed by prefix virtual column
Server crashes in Field::register_field_in_read_map upon select from partitioned table with indexed by prefix virtual column. After several read-mark fixes a problem has surfaced: Since KEY (c(10),a) uses only a prefix of c, a new field is created, duplicated from table->field[3], with a new length. However, vcol_inco->expr is not copied. Therefore, (*key_info)->key_part[i].field->vcol_info->expr was left NULL in ha_partition::index_init(). Solution: copy vcol_info from table field when it's set up.
This commit is contained in:
parent
8b6c8a6ce9
commit
b549af6913
4 changed files with 49 additions and 0 deletions
15
sql/table.cc
15
sql/table.cc
|
|
@ -3284,6 +3284,21 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
|
|||
|
||||
/* Update to use trigger fields */
|
||||
switch_defaults_to_nullable_trigger_fields(outparam);
|
||||
|
||||
for (uint k= 0; k < share->keys; k++)
|
||||
{
|
||||
KEY &key_info= outparam->key_info[k];
|
||||
uint parts = (share->use_ext_keys ? key_info.ext_key_parts :
|
||||
key_info.user_defined_key_parts);
|
||||
for (uint p= 0; p < parts; p++)
|
||||
{
|
||||
KEY_PART_INFO &kp= key_info.key_part[p];
|
||||
if (kp.field != outparam->field[kp.fieldnr - 1])
|
||||
{
|
||||
kp.field->vcol_info = outparam->field[kp.fieldnr - 1]->vcol_info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue