[MDEV-7816] ALTER with DROP INDEX and ADD INDEX .. COMMENT='comment2' ignores the new comment Created: 2015-03-23  Updated: 2019-01-16  Resolved: 2015-04-10

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.0.17, 10.1.3
Fix Version/s: 10.1.4

Type: Bug Priority: Critical
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MDEV-18266 Changing an index comment unnecessari... Closed

 Description   

This script:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT, b INT);
CREATE INDEX i1 ON t1(a) COMMENT 'comment1';  
ALTER TABLE t1 DROP INDEX i1, ADD INDEX i1(a) COMMENT 'comment2';
SHOW CREATE TABLE t1;

returns

+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                           |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL,
  KEY `i1` (`a`) COMMENT 'comment1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------+

Notice, the new comment 'comment2' was ignored. The bug happens when the name and the column list of the new index is exactly the same with the old index.

The expected behaviour would be to replace the comment to 'comment2'.

The problem does not repeat in MariaDB-5.5.



 Comments   
Comment by Daniel Black [ 2015-04-03 ]

patch: https://github.com/MariaDB/server/pull/34

Comment by Alexander Barkov [ 2015-04-10 ]

A contributed patch fixing this problem https://github.com/MariaDB/server/pull/34 has been merged.
Thanks.

Generated at Thu Feb 08 07:22:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.