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.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.059 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.