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

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2022-01-14 18:19:04 +02:00
4 changed files with 56 additions and 7 deletions

View File

@ -2825,15 +2825,19 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
Foreign_key *fk_key= (Foreign_key*) key;
if (fk_key->validate(alter_info->create_list))
DBUG_RETURN(TRUE);
if (fk_key->ref_columns.elements &&
fk_key->ref_columns.elements != fk_key->columns.elements)
if (fk_key->ref_columns.elements)
{
my_error(ER_WRONG_FK_DEF, MYF(0),
(fk_key->name.str ? fk_key->name.str :
"foreign key without name"),
ER_THD(thd, ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
DBUG_RETURN(TRUE);
if (fk_key->ref_columns.elements != fk_key->columns.elements)
{
my_error(ER_WRONG_FK_DEF, MYF(0),
(fk_key->name.str ? fk_key->name.str :
"foreign key without name"),
ER_THD(thd, ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
DBUG_RETURN(TRUE);
}
}
else
fk_key->ref_columns.append(&fk_key->columns);
continue;
}
(*key_count)++;