[MDEV-22635] Cannot add PK when identical UNIQUE key exists Created: 2020-05-19  Updated: 2020-05-21  Resolved: 2020-05-21

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Dorian Sechesan Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-19598 Unexpected ER_WRONG_NAME_FOR_INDEX up... Open

 Description   

Given there is an InnoDB table with no PK, and (at least) one unique key:

CREATE TABLE test_tbl (
  col1 int(10) unsigned NOT NULL,
  UNIQUE KEY uniq (col1)
) ENGINE=innodb;

Attempting to add a PK on the same columns:

ALTER TABLE test_tbl ADD PRIMARY KEY(col1);

Gives the following error:

ERROR 1280 (42000): Incorrect index name 'uniq'

and the PK is not created.

This doesn't happen on latest 10.3 or latest 10.5 from dockerhub, only with 10.4



 Comments   
Comment by Elena Stepanova [ 2020-05-21 ]

Thanks for the report. We already have it filed as MDEV-19598, so let's keep tracking it there.

Generated at Thu Feb 08 09:16:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.