1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-17544 No warning when trying to name a primary key constraint.

Warning added.
This commit is contained in:
Alexey Botchkov
2019-07-30 21:57:48 +04:00
parent 4b5a14d0fe
commit c6efbc543d
28 changed files with 115 additions and 19 deletions

View File

@ -3671,6 +3671,17 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name.str);
DBUG_RETURN(TRUE);
}
if (key->type == Key::PRIMARY && key->name.str &&
my_strcasecmp(system_charset_info, key->name.str, primary_key_name) != 0)
{
bool sav_abort_on_warning= thd->abort_on_warning;
thd->abort_on_warning= FALSE; /* Don't make an error out of this. */
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_NAME_FOR_INDEX,
"Name '%-.100s' ignored for PRIMARY key.",
key->name.str);
thd->abort_on_warning= sav_abort_on_warning;
}
}
tmp=file->max_keys();
if (*key_count > tmp)