summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-02-02 12:44:01 +0100
committerSergei Golubchik <serg@mariadb.org>2017-02-13 18:12:05 +0100
commit460ff39871d6554ec17714a79a174cf8f80f7817 (patch)
tree293c2313372dbe4936b359b79dfcfbc64fa9d788 /sql
parent3cae225b0ff8751a5708bfe4ab0cf52b1badc37e (diff)
downloadmariadb-git-460ff39871d6554ec17714a79a174cf8f80f7817.tar.gz
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
Diffstat (limited to 'sql')
-rw-r--r--sql/table.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 5b491e3e892..c9b356bbbed 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -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;