[MDEV-21097] Incorrect error message when trying to delete column which is part of unique key constraint Created: 2019-11-20  Updated: 2019-11-20  Resolved: 2019-11-20

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.2.29
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Amar Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Environment:

CentOS release 6.8 (Final)
Mariadb 10.2.29


Issue Links:
Duplicate
is duplicated by MDEV-14738 Replication breaks when dropping a co... Confirmed
Relates
relates to MDEV-11114 Cannot drop column referenced by CHEC... Closed
relates to MDEV-13613 Dropping column from table that is pa... Closed

 Description   

MariaDB [mydb]> create table emp( name varchar(11), id int(11));
MariaDB [mydb]> ALTER TABLE emp
-> ADD CONSTRAINT websites_unique UNIQUE (id,name);
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0

MariaDB [mydb]> desc emp;
-------------------------------------+

Field Type Null Key Default Extra

-------------------------------------+

name varchar(11) YES   NULL  
id int(11) YES MUL NULL  

-------------------------------------+
2 rows in set (0.00 sec)

MariaDB [mydb]> alter table emp drop column id;
*ERROR 1072 (42000): Key column 'id' doesn't exist in table
*MariaDB [mydb]>



 Comments   
Comment by Alice Sherepa [ 2019-11-20 ]

please see detailed explanation https://mariadb.com/kb/en/library/alter-table/#drop-column and MDEV-13613
The error message should be fixed with MDEV-14738

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