summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 2fdfdb1c420..c8cd423a84c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3714,6 +3714,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)