1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge 10.3 into 10.4

We disable the MDEV-21189 test galera.galera_partition
because it times out.
This commit is contained in:
Marko Mäkelä
2019-12-13 17:30:37 +02:00
121 changed files with 4286 additions and 3753 deletions

View File

@ -4305,10 +4305,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
continue;
{
/* Check that there's no repeating constraint names. */
/* Check that there's no repeating table CHECK constraint names. */
List_iterator_fast<Virtual_column_info>
dup_it(alter_info->check_constraint_list);
Virtual_column_info *dup_check;
const Virtual_column_info *dup_check;
while ((dup_check= dup_it++) && dup_check != check)
{
if (!lex_string_cmp(system_charset_info,
@ -4320,6 +4320,27 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
}
/* Check that there's no repeating key constraint names. */
List_iterator_fast<Key> key_it(alter_info->key_list);
while (const Key *key= key_it++)
{
/*
Not all keys considered to be the CONSTRAINT
Noly Primary Key UNIQUE and Foreign keys.
*/
if (key->type != Key::PRIMARY && key->type != Key::UNIQUE &&
key->type != Key::FOREIGN_KEY)
continue;
if (check->name.length == key->name.length &&
my_strcasecmp(system_charset_info,
check->name.str, key->name.str) == 0)
{
my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
DBUG_RETURN(TRUE);
}
}
if (check_string_char_length(&check->name, 0, NAME_CHAR_LEN,
system_charset_info, 1))
{
@ -8657,6 +8678,35 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
}
if (!alter_info->check_constraint_list.is_empty())
{
/* Check the table FOREIGN KEYs for name duplications. */
List <FOREIGN_KEY_INFO> fk_child_key_list;
FOREIGN_KEY_INFO *f_key;
table->file->get_foreign_key_list(thd, &fk_child_key_list);
List_iterator<FOREIGN_KEY_INFO> fk_key_it(fk_child_key_list);
while ((f_key= fk_key_it++))
{
List_iterator_fast<Virtual_column_info>
c_it(alter_info->check_constraint_list);
Virtual_column_info *check;
while ((check= c_it++))
{
if (!check->name.length || check->automatic_name)
continue;
if (check->name.length == f_key->foreign_id->length &&
my_strcasecmp(system_charset_info, f_key->foreign_id->str,
check->name.str) == 0)
{
my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
goto err;
}
}
}
}
/* Add new constraints */
new_constraint_list.append(&alter_info->check_constraint_list);