1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä
2020-04-08 10:36:41 +03:00
30 changed files with 483 additions and 328 deletions

View File

@ -4383,6 +4383,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
const Virtual_column_info *dup_check;
while ((dup_check= dup_it++) && dup_check != check)
{
if (!dup_check->name.length || dup_check->automatic_name)
continue;
if (!lex_string_cmp(system_charset_info,
&check->name, &dup_check->name))
{
@ -8703,8 +8705,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 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),
thd->mem_root);
}
if (table->s->tmp_table == NO_TMP_TABLE)
@ -8770,7 +8772,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
tmp_name.str= key_name;
tmp_name.length= strlen(key_name);
/* We dont need LONG_UNIQUE_HASH_FIELD flag because it will be autogenerated */
key= new Key(key_type, &tmp_name, &key_create_info,
key= new (thd->mem_root) Key(key_type, &tmp_name, &key_create_info,
MY_TEST(key_info->flags & HA_GENERATED_KEY),
&key_parts, key_info->option_list, DDL_options());
key->without_overlaps= key_info->without_overlaps;
@ -8850,26 +8852,37 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
// NB: `check` is TABLE resident, we must keep it intact.
if (keep)
{
check= check->clone(thd);
if (!check)
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
goto err;
}
}
if (share->period.constr_name.streq(check->name.str))
{
if (!drop_period && !keep)
if (drop_period)
{
keep= false;
}
else if(!keep)
{
my_error(ER_PERIOD_CONSTRAINT_DROP, MYF(0), check->name.str,
share->period.name.str);
goto err;
}
keep= keep && !drop_period;
DBUG_ASSERT(create_info->period_info.constr == NULL || drop_period);
if (keep)
else
{
Item *expr_copy= check->expr->get_copy(thd);
check= new Virtual_column_info();
check->expr= expr_copy;
DBUG_ASSERT(create_info->period_info.constr == NULL);
create_info->period_info.constr= check;
create_info->period_info.constr->automatic_name= true;
}
}
/* see if the constraint depends on *only* on dropped fields */
if (keep && dropped_fields)
{