Commit 460ff398 authored by Sergei Golubchik's avatar Sergei Golubchik

bugfix: don't calculate vcols if doing keyread

old code didn't calculate vcols that were part of keyread,
but calculated other vcols. It was wrong - there was no guarantee
that vcol's base columns were part of keyread.

Technically it's possible for the vcol not be a part of keyread,
but all its base columns being part of keyread. But currently the
optimizer doesn't do that, keyread is only used if it covers
all columns used in the query.

This fixes crashes of vcol.vcol_trigger_sp_innodb
parent 3cae225b
......@@ -7308,6 +7308,9 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
bool handler_pushed= 0;
DBUG_ASSERT(vfield);
if (h->key_read)
DBUG_RETURN(0);
error= 0;
in_use->set_n_backup_active_arena(expr_arena, &backup_arena);
......@@ -7332,7 +7335,6 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
switch (update_mode) {
case VCOL_UPDATE_FOR_READ:
update= !vcol_info->stored_in_db
&& !(h->key_read && vf->part_of_key.is_set(h->active_index))
&& bitmap_is_set(vcol_set, vf->field_index);
swap_values= 1;
break;
......
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