[MDEV-19598] Unexpected ER_WRONG_NAME_FOR_INDEX upon adding primary key on top of unique Created: 2019-05-25  Updated: 2020-07-18

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Storage Engine - InnoDB
Affects Version/s: 10.4
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Unresolved Votes: 2
Labels: None

Issue Links:
Duplicate
duplicates MDEV-22635 Cannot add PK when identical UNIQUE k... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (pk INT NOT NULL, UNIQUE (pk)) ENGINE=InnoDB;
ALTER TABLE t1 ADD PRIMARY KEY (pk);
 
# Cleanup
DROP TABLE t1;

10.4 5d2619b6

mysqltest: At line 4: query 'ALTER TABLE t1 ADD PRIMARY KEY (pk)' failed: 1280: Incorrect index name 'pk'

Not reproducible on 10.3.



 Comments   
Comment by Mariusz Felisiak [ 2020-07-18 ]

In the Django's test suite we have a test "schema.tests.SchemaTests.test_alter_not_unique_field_to_primary_key" that fails due to this issue. I cannot bisect to a specific change, but it looks to be fixed in MariaDB 10.5.2 (I can still reproduce it on MariaDB 10.5.1).

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