summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-10-22 17:08:49 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-10-22 17:08:49 +0300
commit1657b7a583c62deb72267d485bfe201f43909e11 (patch)
treea750e2a44fdd296837b566623331e8a9a707d290 /sql/sql_table.cc
parentcca75c95bc3c5d0d4a2efb920d3942da3e658654 (diff)
parent9868253b32877554a2707634dc6a6fd79c491053 (diff)
downloadmariadb-git-1657b7a583c62deb72267d485bfe201f43909e11.tar.gz
Merge 10.4 to 10.5
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 16f4330637d..ec4ec0d26e9 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3457,10 +3457,9 @@ 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),
+ Key *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, true),
thd->mem_root);
key_list->push_back(key, thd->mem_root);
return key;
@@ -4034,7 +4033,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
/*
Either field is not present or field visibility is > INVISIBLE_USER
*/
- if (!sql_field)
+ if (!sql_field || (sql_field->invisible > INVISIBLE_USER &&
+ !column->generated))
{
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
DBUG_RETURN(TRUE);
@@ -4742,7 +4742,8 @@ static bool append_system_key_parts(THD *thd, HA_CREATE_INFO *create_info,
break;
}
if (!key_part)
- key->columns.push_back(new Key_part_spec(&row_end_field, 0));
+ key->columns.push_back(new (thd->mem_root)
+ Key_part_spec(&row_end_field, 0, true));
}
key_it.rewind();
}
@@ -4772,8 +4773,10 @@ static bool append_system_key_parts(THD *thd, HA_CREATE_INFO *create_info,
return true;
}
}
- key->columns.push_back(new Key_part_spec(&period_end, 0));
- key->columns.push_back(new Key_part_spec(&period_start, 0));
+ key->columns.push_back(new (thd->mem_root)
+ Key_part_spec(&period_end, 0));
+ key->columns.push_back(new (thd->mem_root)
+ Key_part_spec(&period_start, 0));
}
}
@@ -8861,8 +8864,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key_part_length= 0; // Use whole field
}
key_part_length /= kfield->charset()->mbmaxlen;
- key_parts.push_back(new (thd->mem_root) Key_part_spec(
- &cfield->field_name, key_part_length),
+ key_parts.push_back(new (thd->mem_root) Key_part_spec(&cfield->field_name,
+ key_part_length, true),
thd->mem_root);
}
if (table->s->tmp_table == NO_TMP_TABLE)