summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2020-02-07 23:43:52 +0400
committerEugene Kosov <claprix@yandex.ru>2020-02-13 15:10:25 +0300
commit1394216e3db67152a1356fddd8ddcd563b4f38c3 (patch)
tree69d069188653236f0e65bbd1e521061d8e5d0c2c /sql/table.cc
parentc5e00fea102f0f8d614f60f39737b55dd09b4062 (diff)
downloadmariadb-git-1394216e3db67152a1356fddd8ddcd563b4f38c3.tar.gz
MDEV-21669 InnoDB: Table ... contains <n> indexes inside InnoDB, which is different from the number of indexes <n> defined in the MariaDB
compare_keys_but_name(): do not use KEY_PART_INFO::field for Field::is_equal(). Following the logic of that code we need to compare fields of a table. But KEY_PART_INFO::field sometimes (when key part is shorter than table field) is a different field. In that case Field::is_equal() returns incorrect result and problems occur. KEY_PART_INFO::field may become some strange field in open_frm_error open_table_from_share(). I think this is an incorrect logic, some tecnhical debt. I'm not fixing it right now, because I don't have time. But I'm making Field::field_length a const class member. Then, the only fishy code which changed that field requires now a const_cast<>. I'm bringing attention to that code with it. This change should not affect logic of the program in any way.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 6426cb57524..4962a002cb9 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3759,7 +3759,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
*/
field= key_part->field=field->make_new_field(&outparam->mem_root,
outparam, 0);
- field->field_length= key_part->length;
+ const_cast<uint32_t&>(field->field_length)= key_part->length;
}
}
if (!share->use_ext_keys)