mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-8582: innodb_force_primary_key option does not force PK or unique key
Analysis: Handler used table flag HA_REQUIRE_PRIMARY_KEY but a bug on sql_table.cc function mysql_prepare_create_table internally marked secondary key with NOT NULL colums as unique key and did not then fail on requirement that table should have primary key or unique key.
This commit is contained in:
@@ -4042,7 +4042,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key_info->name);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (!(key_info->flags & HA_NULL_PART_KEY))
|
||||
if (key->type == Key::UNIQUE && !(key_info->flags & HA_NULL_PART_KEY))
|
||||
unique_key=1;
|
||||
key_info->key_length=(uint16) key_length;
|
||||
if (key_length > max_key_length && key->type != Key::FULLTEXT)
|
||||
|
Reference in New Issue
Block a user