Bug #107001 X Protocol not accepting any other character set than utf8mb4
Submitted: 13 Apr 2022 8:57 Modified: 13 Apr 2022 9:47
Reporter: Geert Vanderkelen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Document Store: X Plugin Severity:S3 (Non-critical)
Version:8.0.28 OS:Any
Assigned to: CPU Architecture:Any

[13 Apr 2022 8:57] Geert Vanderkelen
Description:
We have discussed this on Slack: the X Protocol does not allow any other character set other than utf8mb4. It is not possible to, for example, use SET NAMES to change to 'latin1'. Executing `SET NAMES` is actually a no-op.

From the discussion, I have learned that this is by design. However, it is nowhere really mentioned. Since the collation list is prominently documented in the X Protocol internals:
  https://dev.mysql.com/doc/dev/mysql-server/latest/mysqlx_protocol_xplugin.html#xplugin_Col...

and the collation is provided with Bytes Columns, one can assume that character sets are supported.

How to repeat:
Start mysqlsh, and execute

SET NAMES 'latin1';

followed by:

SHOW VARIABLES LIKE 'char%';

nothing changed.

Suggested fix:
1) Add everywhere where SET NAMES or character sets are documented, that this ain't working with X Plugin/Protocol. So X Protocol is not a replacement for users using 'big5' for example. Also, update the internals to reflect that. It is very confusing.

2) This is not documentation, but maybe think about error on SET NAMES when used over X Plugin, or give warnings when the relevant session variables are being changed.
[13 Apr 2022 9:04] Geert Vanderkelen
A note: this is about character sets, not collations.
It is possible to set the collation within the utf8mb4 character set.

has no effect:
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_lithuanian_ci'

does work:
SET @@collation_connection = utf8mb4_lithuanian_ci
[13 Apr 2022 9:47] MySQL Verification Team
Hello Geert,

Thank you for the report and feedback.
Verified as described.

Regards,
Umesh