Details

    Description

      1) MySQL 5.7 has RENAME INDEX, MariaDB should, too.

      http://dev.mysql.com/doc/refman/5.7/en/alter-table.html
      "RENAME INDEX old_index_name TO new_index_name" renames an index.

      2) My permute-index tool creates synthetic index names that need to be renamed later for esthetic reasons (ie. idx_jb_007.)

      Attachments

        Issue Links

          Activity

            For what it is worth, I would always have liked ALTER TABLE…RENAME COLUMN syntax when I implemented the InnoDB counterparts of MySQL WL#5534 (ALTER TABLE…ALGORITHM=INPLACE) in MySQL 5.6. Currently the way to rename columns is error-prone, because you will have to specify the old type and ⟦NOT⟧ NULL of the column. Make a subtle mistake, and you will be punished with ALGORITHM=COPY that will convert the column data type.

            MySQL 5.7 introduced RENAME INDEX syntax, but no RENAME COLUMN.

            That said, I think that it should be technically possible to rename an index by specifying DROP INDEX old_name, ADD INDEX new_name(old_index_column). In practice, InnoDB would unnecessarily drop and create an index, even though only the name is changing.

            marko Marko Mäkelä added a comment - For what it is worth, I would always have liked ALTER TABLE…RENAME COLUMN syntax when I implemented the InnoDB counterparts of MySQL WL#5534 (ALTER TABLE…ALGORITHM=INPLACE) in MySQL 5.6. Currently the way to rename columns is error-prone, because you will have to specify the old type and ⟦NOT⟧ NULL of the column. Make a subtle mistake, and you will be punished with ALGORITHM=COPY that will convert the column data type. MySQL 5.7 introduced RENAME INDEX syntax, but no RENAME COLUMN. That said, I think that it should be technically possible to rename an index by specifying DROP INDEX old_name, ADD INDEX new_name(old_index_column). In practice, InnoDB would unnecessarily drop and create an index, even though only the name is changing.
            mxu Michael Xu added a comment -

            This is a really useful feature, please consider RENAME CHECK as well.

            mxu Michael Xu added a comment - This is a really useful feature, please consider RENAME CHECK as well.

            MySQL 8.0 has got ALTER TABLE…RENAME COLUMN. So I think it is definitely worth to bring it also to MariaDB due to the reasons cited by @marko and in the MySQL Worklog Task WL#10761.

            Although not a standard instruction it is also supported by Oracle and PostgreSQL.

            mdw Matthias Wallnöfer added a comment - MySQL 8.0 has got ALTER TABLE…RENAME COLUMN. So I think it is definitely worth to bring it also to MariaDB due to the reasons cited by @marko and in the MySQL Worklog Task WL#10761 . Although not a standard instruction it is also supported by Oracle and PostgreSQL.
            archon810 Artem Russakovskii added a comment - - edited

            MDEV-13301 says renaming indexes was added in 10.4.4.

            Should this ticket be marked as fixed too then?

            archon810 Artem Russakovskii added a comment - - edited MDEV-13301 says renaming indexes was added in 10.4.4. Should this ticket be marked as fixed too then?

            No, the description of MDEV-13301 is a bit misleading.

            After MDEV-13301 the server can automatically detect if a pair of DROP INDEX, ADD INDEX simply recreate an index under a different name without changing index definition. In this case internally MariaDB will rename the index without rebuilding it.

            But there is still no explicit ALTER TABLE ... RENAME INDEX command, so this MDEV-7318 is still valid.

            serg Sergei Golubchik added a comment - No, the description of MDEV-13301 is a bit misleading. After MDEV-13301 the server can automatically detect if a pair of DROP INDEX, ADD INDEX simply recreate an index under a different name without changing index definition. In this case internally MariaDB will rename the index without rebuilding it. But there is still no explicit ALTER TABLE ... RENAME INDEX command, so this MDEV-7318 is still valid.
            mdw Matthias Wallnöfer added a comment - - edited

            Issue for ALTER TABLE...RENAME COLUMN, would be nice if also this feature could make it into release 10.5 like the other one.

            mdw Matthias Wallnöfer added a comment - - edited Issue for ALTER TABLE...RENAME COLUMN, would be nice if also this feature could make it into release 10.5 like the other one.

            Already in MySQL 5.6 or MariaDB 10.0 you could rename columns, but only by using the CHANGE COLUMN syntax, which requires the full column specification. If you accidentally changed the column specification in some way (such as omitting NOT NULL, or specifying the wrong length for a character column), the operation would involve more than just renaming the column. Already back in summer or autumn 2012 when I was implementing the InnoDB part of ALTER TABLE operations in MySQL 5.6, I argued that the RENAME COLUMN syntax should be supported.

            RENAME INDEX was introduced in MySQL 5.7 and RENAME COLUMN in MySQL 8.0.

            marko Marko Mäkelä added a comment - Already in MySQL 5.6 or MariaDB 10.0 you could rename columns, but only by using the CHANGE COLUMN syntax, which requires the full column specification. If you accidentally changed the column specification in some way (such as omitting NOT NULL , or specifying the wrong length for a character column), the operation would involve more than just renaming the column. Already back in summer or autumn 2012 when I was implementing the InnoDB part of ALTER TABLE operations in MySQL 5.6, I argued that the RENAME COLUMN syntax should be supported. RENAME INDEX was introduced in MySQL 5.7 and RENAME COLUMN in MySQL 8.0.

            People

              midenok Aleksey Midenkov
              mrperl James Briggs
              Votes:
              6 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.