summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc35
1 files changed, 19 insertions, 16 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 78721c3e8f9..ad39b91a5ca 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -479,12 +479,16 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
}
else if (column->length > length ||
- (f_is_packed(sql_field->pack_flag) && column->length != length))
+ ((f_is_packed(sql_field->pack_flag) ||
+ ((file->option_flag() & HA_NO_PREFIX_CHAR_KEYS) &&
+ (key_info->flags & HA_NOSAME))) &&
+ column->length != length))
{
my_error(ER_WRONG_SUB_KEY,MYF(0));
DBUG_RETURN(-1);
}
- length=column->length;
+ if (!(file->option_flag() & HA_NO_PREFIX_CHAR_KEYS))
+ length=column->length;
}
else if (length == 0)
{
@@ -1426,21 +1430,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
create_info,
create_list,key_list,1,1))) // no logging
DBUG_RETURN(error);
+
+ if (table->tmp_table)
+ new_table=open_table(thd,new_db,tmp_name,tmp_name,0);
+ else
{
- if (table->tmp_table)
- new_table=open_table(thd,new_db,tmp_name,tmp_name,0);
- else
- {
- char path[FN_REFLEN];
- (void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,tmp_name);
- fn_format(path,path,"","",4);
- new_table=open_temporary_table(thd, path, new_db, tmp_name,0);
- }
- if (!new_table)
- {
- VOID(quick_rm_table(new_db_type,new_db,tmp_name));
- goto err;
- }
+ char path[FN_REFLEN];
+ (void) sprintf(path,"%s/%s/%s",mysql_data_home,new_db,tmp_name);
+ fn_format(path,path,"","",4);
+ new_table=open_temporary_table(thd, path, new_db, tmp_name,0);
+ }
+ if (!new_table)
+ {
+ VOID(quick_rm_table(new_db_type,new_db,tmp_name));
+ goto err;
}
save_time_stamp=new_table->time_stamp;