Bug #64439 Add Comment to MySQL Column without Redefining its Type
Submitted: 23 Feb 2012 17:43 Modified: 23 Feb 2012 19:24
Reporter: David ZZZ Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[23 Feb 2012 17:43] David ZZZ
Description:
This is a feature request.

In MySQL, you can currently add a comment to a column with the following syntax:

ALTER TABLE `myTable` CHANGE `myField` `myField` varchar(20) NOT NULL COMMENT 'my comment'

This process is error prone since you need to re-declare the data type whenever you edit/update a comment for the column. I think that MySQL should add the following syntax:

ALTER TABLE 'myTable' ALTER COLUMN `myField` ADD COMMENT 'a comment'

(or some other convenient syntax that permits changing the comment without redefining the column's data type)

How to repeat:
1. Create a table in MySQL
Create table myTable(myTableId int, myField varchar(20) NOT NULL);

2. Add a comment to one of the fields.

Suggested fix:
See Description
[23 Feb 2012 19:24] Valeriy Kravchuk
Thank you for the feature request.
[12 Apr 2013 11:26] Yogeshwar Rachcha
This is very easily done in Oracle like this:

COMMENT ON COLUMN employees.job_id 
   IS 'abbreviated job title';
[3 Dec 2014 18:37] Andre Carlucci
Please, implement this!
[4 Jan 2018 12:59] Lukas Eder
If this is going to be implemented, then please use the syntax supported by many other databases, including DB2, Oracle, PostgreSQL:

COMMENT ON <object type> IS 'comment';