MDEV-5743 Server crashes in mysql_alter_table on an attempt to add a primary key to InnoDB table

This commit is contained in:
Sergei Golubchik 2014-04-07 21:53:19 +02:00
commit 5f0c98c17b
3 changed files with 21 additions and 1 deletions

View file

@ -6908,7 +6908,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (is_PK(key_info))
{
merged[0]= key_info[0];
if (is_PK(table->key_info))
if (table->key_info && is_PK(table->key_info))
{
old_cnt--;
table->key_info++;