tidb icon indicating copy to clipboard operation
tidb copied to clipboard

failed to add column comment by using alter column statement

Open tshqin opened this issue 9 years ago • 3 comments

  1. What did you do? If possible, provide a recipe for reproducing the error. as #4224 stated, the table/column comments were lost when I executed the mysql DDL, then I tried the alter column statement: alter table 't_bs_s_data_item' modify column 'ITEM_CD' comment '数据项代码'; and alter table 't_bs_s_data_item' column 'ITEM_CD' comment '数据项代码';

  2. What did you expect to see? Query OK

  3. What did you see instead? error msg: MySQL [gin]> alter table 't_bs_s_data_item' modify column 'ITEM_CD' comment '数据项代码'; ERROR 1105 (HY000): line 0 column 31 near "modify column 'ITEM_CD' comment '数据项代码'" (total length 80) and MySQL [gin]> alter table 't_bs_s_data_item' column 'ITEM_CD' comment '数据项代码'; ERROR 1105 (HY000): line 0 column 31 near "column 'ITEM_CD' comment '数据项代码'" (total length 73)

  4. What version of TiDB are you using (tidb-server -V)? Git Commit Hash: 365e4ab491b683a69c2004f30b1ae4f86256e2ad Git Commit Branch: master UTC Build Time: 2017-08-16 01:24:27

tshqin avatar Aug 17 '17 15:08 tshqin

@tshqin I tried this statement alter table `t_bs_s_data_item` modify column `ITEM_CD` comment '数据项代码'; in MySQL, it also returns an error ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'comment '数据项代码'' at line 1. I think this statement needs to add the type like alter table `t_bs_s_data_item` modify column `ITEM_CD` varchar(11) comment '数据项代码';

zimulala avatar Aug 21 '17 04:08 zimulala

using your statement, i got an ok msg, thanks!

tshqin avatar Aug 21 '17 05:08 tshqin

@tshqin Not at all.

zimulala avatar Aug 21 '17 05:08 zimulala