max_key_length MyISAM bugfix

parent e8c6e271
......@@ -370,7 +370,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
share.state.rec_per_key_part[key_segs-1]=1L;
length+=key_length;
keydef->block_length= MI_BLOCK_SIZE(length,pointer,MI_MAX_KEYPTR_SIZE);
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH)
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
length > MI_MAX_KEY_LENGTH)
{
my_errno=HA_WRONG_CREATE_OPTION;
goto err;
......
......@@ -627,7 +627,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (!(key_info->flags & HA_NULL_PART_KEY))
unique_key=1;
key_info->key_length=(uint16) key_length;
uint max_key_length= max(file->max_key_length(), MAX_KEY_LENGTH);
uint max_key_length= min(file->max_key_length(), MAX_KEY_LENGTH);
if (key_length > max_key_length && key->type != Key::FULLTEXT)
{
my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment