diff options
author | Sachin <sachin.setiya@mariadb.com> | 2019-02-25 13:42:43 +0530 |
---|---|---|
committer | Sachin <sachin.setiya@mariadb.com> | 2019-02-25 13:42:43 +0530 |
commit | 5ddae0e0551bfaa64187ab6f3738065475310c79 (patch) | |
tree | 444b449d5827ff21344930d5982967f31ae6f075 /sql/sql_table.cc | |
parent | 9011fa1ace3c6a49afdf05c714844d938a8c6f99 (diff) | |
download | mariadb-git-bb-10.4-release-long_unique.tar.gz |
Fix Inndb alter table and fix innodb not null long unique.bb-10.4-release-long_unique
Also make long_unique a universal test so that it can be used for innodb,
myisam and other storage engine in future.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5cb836f6bd0..96bb7b20f57 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4187,13 +4187,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, hash_fld->offset= record_offset; hash_fld->charset= create_info->default_table_charset; record_offset+= hash_fld->pack_length; - if (key_info->flags & HA_NULL_PART_KEY) - null_fields++; - else - { - hash_fld->flags|= NOT_NULL_FLAG; - hash_fld->pack_flag&= ~FIELDFLAG_MAYBE_NULL; - } + key_info->flags|= HA_NULL_PART_KEY; + null_fields++; } if (validate_comment_length(thd, &key->key_create_info.comment, INDEX_COMMENT_MAXLEN, @@ -9197,6 +9192,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, uint order_num, ORDER *order, bool ignore) { DBUG_ENTER("mysql_alter_table"); + bool long_unique_table= false; /* Check if we attempt to alter mysql.slow_log or @@ -9804,8 +9800,15 @@ do_continue:; /* Remember that we have not created table in storage engine yet. */ bool no_ha_table= true; + for(uint i= 0; i < key_count; i++) + if (key_info[i].algorithm == HA_KEY_ALG_LONG_HASH) + { + long_unique_table= true; + break; + } - if (alter_info->requested_algorithm != Alter_info::ALTER_TABLE_ALGORITHM_COPY) + if (alter_info->requested_algorithm != Alter_info::ALTER_TABLE_ALGORITHM_COPY && + !long_unique_table) { Alter_inplace_info ha_alter_info(create_info, alter_info, key_info, key_count, |