diff options
author | Sachin Setiya <sachinsetia1001@gmail.com> | 2017-11-22 02:58:59 +0530 |
---|---|---|
committer | Sachin Setiya <sachinsetia1001@gmail.com> | 2017-11-22 14:43:10 +0530 |
commit | 115052e4a3ad06606a314fa2bb0acb18f33960cd (patch) | |
tree | ee38df1bf5094c8f2486975abb619c8013ca818b | |
parent | 1fda3d9cacf85aac0e3e8d385de55882e3c13552 (diff) | |
download | mariadb-git-115052e4a3ad06606a314fa2bb0acb18f33960cd.tar.gz |
Some error solved , Some remaining
-rw-r--r-- | mysql-test/t/hidden_field_debug.test | 9 | ||||
-rw-r--r-- | sql/sql_table.cc | 23 |
2 files changed, 25 insertions, 7 deletions
diff --git a/mysql-test/t/hidden_field_debug.test b/mysql-test/t/hidden_field_debug.test index 84b89307a88..f25e68ef03e 100644 --- a/mysql-test/t/hidden_field_debug.test +++ b/mysql-test/t/hidden_field_debug.test @@ -1,4 +1,5 @@ --source include/have_debug.inc +--disable_parsing ##TEST for invisible coloumn level 2 set @old_debug= @@debug_dbug; set debug_dbug= "+d,test_pseudo_invisible"; @@ -167,10 +168,11 @@ alter table t1 add index(invisible); alter table t1 add index(b,invisible); show index from t1; drop table t1; +--enable_parsing ## Sytem Generated index on invisible column set debug_dbug= "+d,test_completely_invisible,test_invisible_index"; ## index name will be invisible -Create table t1( a int default(99) , b int,c int, index(invisible), index(b)); +Create table t1( a int default(99) , b int,c int, index(b)); set debug_dbug=@old_debug; Show index from t1; select * from INFORMATION_SCHEMA.STATISTICS where TABLE_SCHEMA ='test' and table_name='t1'; @@ -179,6 +181,9 @@ insert into t1 values(1,1,1); insert into t1 values(2,2,2); insert into t1 values(3,3,3); insert into t1 values(4,4,4); +set debug_dbug= "+d,test_completely_invisible,test_invisible_index"; +explain select * from t1 where invisible =9; +--disable_parsing set debug_dbug= "+d,test_completely_invisible"; select invisible, a ,b from t1 order by b; explain select * from t1 where invisible =9; @@ -194,7 +199,9 @@ set debug_dbug= "+d,test_completely_invisible,test_invisible_index"; --error ER_CANT_DROP_FIELD_OR_KEY drop index invisible on t1; explain select * from t1 where invisible =9; +--enable_parsing ## index name will be changed +set debug_dbug= "+d,test_completely_invisible,test_invisible_index"; create index invisible on t1(c); explain select * from t1 where invisible =9; drop table t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8ea88ce7edd..1658d8b8f44 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -62,7 +62,7 @@ const char *primary_key_name="PRIMARY"; -static bool check_if_keyname_exists(const char *name,KEY *start, KEY *end); +static int check_if_keyname_exists(const char *name,KEY *start, KEY *end); static char *make_unique_key_name(THD *thd, const char *field_name, KEY *start, KEY *end); static void make_unique_constraint_name(THD *thd, LEX_CSTRING *name, @@ -3318,6 +3318,19 @@ int mysql_add_invisible_field(THD *thd, List<Create_field> * field_list, field_list->push_front(fld, thd->mem_root); return 0; } + +Key * +mysql_add_invisible_index(THD *thd, List<Key> *key_list, + LEX_CSTRING* field_name, enum Key::Keytype type) +{ + Key *key= NULL; + key= new (thd->mem_root) Key(type, &null_clex_str, HA_KEY_ALG_UNDEF, + false, DDL_options(DDL_options::OPT_NONE)); + key->columns.push_back(new(thd->mem_root) Key_part_spec(field_name, 0), + thd->mem_root); + key_list->push_back(key, thd->mem_root); + return key; +} /* Preparation for table creation @@ -3379,10 +3392,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, LEX_CSTRING temp; temp.str= "invisible"; temp.length= strlen("invisible"); - //TODO sometime alter_list != thd->lex->alter_list , - //I forgot when , but I remember that is why I send create_list - //as a parameter in mysql_add_invisible_field - thd->lex->add_key_to_list(&temp, Key::UNIQUE, false); + mysql_add_invisible_index(thd, &alter_info->key_list + , &temp, Key::MULTIPLE); }); LEX_CSTRING* connect_string = &create_info->connect_string; if (connect_string->length != 0 && @@ -5139,7 +5150,7 @@ err: [1..) index + 1 of duplicate key name **/ -static bool +static int check_if_keyname_exists(const char *name, KEY *start, KEY *end) { uint i= 1; |