Bug #58006 Support for ALTER TABLE RENAME COLUMN
Submitted: 5 Nov 2010 8:22 Modified: 24 Aug 2017 23:54
Reporter: Adrien de Croy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version:any OS:Any
Assigned to: CPU Architecture:Any
Tags: ALTER TABLE RENAME COLUMN

[5 Nov 2010 8:22] Adrien de Croy
Description:
Currently the only way to rename a column is to use the CHANGE clause.

This is a very poor design.

This has the unfortunate requirement of requiring re-specification of all the attributes of the column.  These may not be available to the code trying to do the rename (e.g. DB migration C++ code).

If you just want to simply rename it, you are treading on a minefield.  Chances are you'll alter some other attribute of the column, and/or lose data.

Also to make it worse, since it's possible to alter data type (inadvertently) each row in the column needs to be checked for truncation etc.  This makes a column rename ridiculously slow for what is really required.

So, the current method of renaming columns is simply a very poor design, and this is why other DBs have the RENAME COLUMN option.

How to repeat:
I can't believe this field is mandatory  web devs setting policy yet again.

THIS IS A FEATURE REQUEST.

Suggested fix:
Please consider adding the syntax.  It should be really easy.

For examples look at the PostgreSQL or Oracle documentation.
[5 Nov 2010 10:37] Valeriy Kravchuk
Thank you for the feature request.
[3 Mar 2012 12:30] Valeriy Kravchuk
Duplicate of bug #26949.
[24 Aug 2017 18:24] Abhishek Ranjan
Posted by developer:
 
Implemented via worklog WL#10761
[24 Aug 2017 23:54] Paul DuBois
Posted by developer:
 
Fixed in 8.0.3.

ALTER TABLE now supports easier column renaming using RENAME COLUMN
old_name TO new_name syntax. RENAME COLUMN is more convenient than
CHANGE, which requires respecifying the current column definition.