Bug #97152 JSON type can not change CHARACTER SET error
Submitted: 9 Oct 2019 9:18 Modified: 9 Oct 2019 15:22
Reporter: 文静 刘 Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Charsets Severity:S4 (Feature request)
Version:8.0.17 OS:Windows (win 10 pro)
Assigned to: CPU Architecture:Any
Tags: JSON ;CHARACTER SET;

[9 Oct 2019 9:18] 文静 刘
Description:
When changing any JSON Datatype column's Charset, the workbench show's syntax error.

How to repeat:
ALTER TABLE `transms_dev`.`a_addsalary` CHANGE COLUMN `json` `json` JSON CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NULL DEFAULT NULL ;

this sql show's syntax error in workbench.

ALTER TABLE `transms_dev`.`a_addsalary` CHANGE COLUMN `json` `json` CHAR CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci' NULL DEFAULT NULL ;

and this not.
[9 Oct 2019 15:22] Mike Lischke
Hi, this is not a bug because JSON columns cannot have a character set attached. See https://dev.mysql.com/doc/refman/8.0/en/create-table.html (same syntax as for ALTER TABLE). The data_type section mentions that not all attributes apply to all data types, saying also:

Character data types (CHAR, VARCHAR, the TEXT types, ENUM, SET, and any synonyms) can include CHARACTER SET to specify the character set for the column. CHARSET is a synonym for CHARACTER SET.