[MDEV-7318] RENAME INDEX Created: 2014-12-14 Updated: 2021-08-23 Resolved: 2020-03-03 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Parser |
| Fix Version/s: | 10.5.2 |
| Type: | Task | Priority: | Major |
| Reporter: | James Briggs | Assignee: | Aleksey Midenkov |
| Resolution: | Fixed | Votes: | 6 |
| Labels: | Compatibility, compat57, index | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Description |
|
1) MySQL 5.7 has RENAME INDEX, MariaDB should, too. http://dev.mysql.com/doc/refman/5.7/en/alter-table.html 2) My permute-index tool creates synthetic index names that need to be renamed later for esthetic reasons (ie. idx_jb_007.) |
| Comments |
| Comment by Marko Mäkelä [ 2017-09-18 ] |
|
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. |
| Comment by Michael Xu [ 2017-11-15 ] |
|
This is a really useful feature, please consider RENAME CHECK as well. |
| Comment by Matthias Dieter Wallnöfer [ 2017-11-15 ] |
|
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. |
| Comment by Artem Russakovskii [ 2019-09-18 ] |
|
Should this ticket be marked as fixed too then? |
| Comment by Sergei Golubchik [ 2019-09-19 ] |
|
No, the description of After But there is still no explicit ALTER TABLE ... RENAME INDEX command, so this |
| Comment by Matthias Dieter Wallnöfer [ 2019-10-11 ] |
|
Issue for ALTER TABLE...RENAME COLUMN, would be nice if also this feature could make it into release 10.5 like the other one. |
| Comment by Marko Mäkelä [ 2019-10-14 ] |
|
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. |