Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7816

ALTER with DROP INDEX and ADD INDEX .. COMMENT='comment2' ignores the new comment

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.0.17, 10.1.3
    • Fix Version/s: 10.1.4
    • Labels:
      None

      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.

        Gliffy Diagrams

          Attachments

            Activity

            Show
            danblack Daniel Black added a comment - patch: https://github.com/MariaDB/server/pull/34
            Hide
            bar Alexander Barkov added a comment -

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

            Show
            bar Alexander Barkov added a comment - A contributed patch fixing this problem https://github.com/MariaDB/server/pull/34 has been merged. Thanks.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: