Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3067,11 +3067,10 @@ my_bool init_key_info(THD *thd, Alter_info *alter_info,

if (is_hash_field_needed)
{
if (key_cinfo->algorithm == HA_KEY_ALG_UNDEF)
if (key_cinfo->algorithm == HA_KEY_ALG_UNDEF || key_cinfo->algorithm == HA_KEY_ALG_HASH)
key_cinfo->algorithm= HA_KEY_ALG_LONG_HASH;

if (key_cinfo->algorithm != HA_KEY_ALG_HASH &&
key_cinfo->algorithm != HA_KEY_ALG_LONG_HASH)
if (key_cinfo->algorithm != HA_KEY_ALG_LONG_HASH)
{
my_error(ER_TOO_LONG_KEY, MYF(0), max_key_length);
DBUG_RETURN(TRUE);
Expand Down Expand Up @@ -9163,7 +9162,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
LEX_CSTRING tmp_name;
bzero((char*) &key_create_info, sizeof(key_create_info));
if (key_info->algorithm == HA_KEY_ALG_LONG_HASH)
key_info->algorithm= alter_ctx->fast_alter_partition ?
key_info->algorithm= (alter_ctx->fast_alter_partition || !(alter_info->flags & ALTER_CHANGE_COLUMN)) ?
HA_KEY_ALG_HASH : HA_KEY_ALG_UNDEF;
/*
For fast alter partition we set HA_KEY_ALG_HASH above to make sure it
Expand Down