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

            mrperl James Briggs created issue -
            ratzpo Rasmus Johansson (Inactive) made changes -
            Field Original Value New Value
            Workflow MariaDB v2 [ 58952 ] MariaDB v3 [ 65609 ]
            serg Sergei Golubchik made changes -
            Summary Feature request: RENAME INDEX RENAME INDEX

            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.
            marko Marko Mäkelä made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Support case ID 25127
            ralf.gebhardt Ralf Gebhardt made changes -
            Labels index compat57 index
            ralf.gebhardt Ralf Gebhardt made changes -
            Labels compat57 index Compatibility compat57 index
            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.
            mdw Matthias Wallnöfer made changes -

            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.
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ]
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.5.2 [ 24030 ]
            midenok Aleksey Midenkov made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            midenok Aleksey Midenkov made changes -
            Assignee Aleksey Midenkov [ midenok ] Oleksandr Byelkin [ sanja ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            sanja Oleksandr Byelkin made changes -
            Assignee Oleksandr Byelkin [ sanja ] Aleksey Midenkov [ midenok ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.5 [ 23123 ]
            midenok Aleksey Midenkov made changes -
            Component/s Parser [ 10201 ]
            Component/s Server [ 13907 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            midenok Aleksey Midenkov made changes -
            Component/s Data Definition - Alter Table [ 10114 ]
            Component/s Server [ 13907 ]
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            marko Marko Mäkelä made changes -
            elenst Elena Stepanova made changes -
            midenok Aleksey Midenkov made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 65609 ] MariaDB v4 [ 132488 ]

            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.