summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-10-22 13:27:18 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-10-22 13:27:18 +0300
commit46957a6a77518b579c6c8e1345666f84a5a59455 (patch)
treec0e463f14123cd09bb4d5854d32577e44b3a9827 /sql/sql_table.cc
parent1619ae899099c4934f3b5919b2398c95a7cacc94 (diff)
parente3d692aa092a76415ce1ce0e9662338873d84abb (diff)
downloadmariadb-git-46957a6a77518b579c6c8e1345666f84a5a59455.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index c90387cf1c3..942b838c692 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3346,7 +3346,7 @@ mysql_add_invisible_index(THD *thd, List<Key> *key_list,
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->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;
@@ -3863,7 +3863,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);
@@ -4577,9 +4578,10 @@ static bool vers_prepare_keys(THD *thd, HA_CREATE_INFO *create_info,
if (key_part)
continue; // Key already contains Sys_start or Sys_end
- Key_part_spec *key_part_sys_end_col=
- new (thd->mem_root) Key_part_spec(&create_info->vers_info.as_row.end, 0);
- key->columns.push_back(key_part_sys_end_col);
+ Key_part_spec *row_end=
+ new (thd->mem_root) Key_part_spec(&create_info->vers_info.as_row.end, 0,
+ true);
+ key->columns.push_back(row_end);
}
return false;
@@ -8501,8 +8503,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)