diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-14 11:35:39 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-14 11:35:39 +0300 |
commit | 6c3e860cbf36831c118f6ea183acbbeb3c889bed (patch) | |
tree | 8585545cc8a95e790c01eb164f74685674f9f23b /sql/sql_table.cc | |
parent | 9ff737b25edbcb0c74d9d312f6da702e7d993e88 (diff) | |
parent | 5008171b05e0d3b8b5f4af312b94a312281e77c7 (diff) | |
download | mariadb-git-6c3e860cbf36831c118f6ea183acbbeb3c889bed.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f1e1b6517d8..99070bcd89c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -8833,6 +8833,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, long_hash_key= true; } const char *dropped_key_part= NULL; + bool user_keyparts= false; // some user-defined keyparts left KEY_PART_INFO *key_part= key_info->key_part; key_parts.empty(); uint key_parts_nr= key_info->user_defined_key_parts; @@ -8912,6 +8913,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, key_parts.push_back(new (thd->mem_root) Key_part_spec(&cfield->field_name, key_part_length, true), thd->mem_root); + if (cfield->invisible < INVISIBLE_SYSTEM) + user_keyparts= true; } if (table->s->tmp_table == NO_TMP_TABLE) { @@ -8957,7 +8960,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, key_type= Key::PRIMARY; else key_type= Key::UNIQUE; - if (dropped_key_part) + if (dropped_key_part && user_keyparts) { my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), dropped_key_part); if (long_hash_key) |