Bug #66782 New parameter for preventing User from mistake removing the comment when DDL
Submitted: 12 Sep 2012 10:24 Modified: 2 Feb 2013 12:32
Reporter: xiaobin lin (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version:5.5+ OS:Any
Assigned to: CPU Architecture:Any

[12 Sep 2012 10:24] xiaobin lin
When user run a ddl to update attribute of columns in table, the common command may be "alter table tb change f f varchar(100) not null". 

If the column is "f varchar(50) comment 'the meaning of this colum'", this comnand will remove the comment.

Though keep reminding users DO NOT FORGET THE COMMENT, but the case occurs now and then.

How to repeat:
AS above

Suggested fix:
I think we can have a parameter to control the case. 

show variables like 'not_allow_reset_comment';
| Variable_name           | Value |
| not_allow_reset_comment | ON    |

When it is on, if an ALTER TABLE command want to change a column and remove the comment, the query fails.

If user indeed want to remove the comment, the command can be

set 'not_allow_reset_comment = off;
alter table xxxxxxxx

The effects above comes from the patch bellow.
[12 Sep 2012 10:27] xiaobin lin
Based on 5.5.27 revno: 3900

Attachment: prevent_remove_comment.diff (application/octet-stream, text), 1.61 KiB.

[2 Feb 2013 12:32] MySQL Verification Team
Thanks for the contribution.  Similar: http://bugs.mysql.com/bug.php?id=42628