mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -6634,7 +6634,7 @@ Compare_keys compare_keys_but_name(const KEY *table_key, const KEY *new_key,
|
||||
*/
|
||||
const Field *old_field= table->field[key_part->fieldnr - 1];
|
||||
|
||||
bool is_equal= key_part->field->is_equal(*new_field);
|
||||
bool is_equal= old_field->is_equal(*new_field);
|
||||
/* TODO: below is an InnoDB specific code which should be moved to InnoDB */
|
||||
if (!is_equal)
|
||||
{
|
||||
|
Reference in New Issue
Block a user