diff options
author | unknown <serg@serg.mylan> | 2004-05-14 12:49:18 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-05-14 12:49:18 +0200 |
commit | 321d50fd06c7ddcc9a32ed661c3a91e48178e6f8 (patch) | |
tree | de887cd555d5743340c1f8dcc0cf303148cdb537 /sql/sql_table.cc | |
parent | 1d51406e298ed7e3f6ddb5e239088a03774418ef (diff) | |
download | mariadb-git-321d50fd06c7ddcc9a32ed661c3a91e48178e6f8.tar.gz |
better fix for bug#3749 - do not consider already removed keys in key removal process
mysql-test/r/innodb.result:
tests for bug#3749
mysql-test/t/innodb.test:
tests for bug#3749
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 47574eab666..8d5ec56add9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -688,9 +688,10 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, 'generated', and a generated key is a prefix of the other key. Then we do not need the generated shorter key. */ - if ((key2->type != Key::FOREIGN_KEY && !foreign_key_prefix(key, key2))) + if (key2->name != ignore_key && key2->type != Key::FOREIGN_KEY && + !foreign_key_prefix(key, key2)) { - /* TO DO: issue warning message */ + /* TODO: issue warning message */ /* mark that the generated key should be ignored */ if (!key2->generated || (key->generated && key->columns.elements < @@ -698,17 +699,9 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, key->name= ignore_key; else { - /* - Remove the previous, generated key if it has not yet been - removed. Note that if we have several identical generated keys, - the last one will remain and others get removed here. - */ - if (key2->name != ignore_key) - { - key2->name= ignore_key; - key_parts-= key2->columns.elements; - (*key_count)--; - } + key2->name= ignore_key; + key_parts-= key2->columns.elements; + (*key_count)--; } break; } |