| Bug #114857 | Contribution: Update charset/collation description indicate this is 16-bits ... | ||
|---|---|---|---|
| Submitted: | 2 May 2024 18:09 | Modified: | 12 Sep 2024 20:11 |
| Reporter: | OCA Admin (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / Python | Severity: | S3 (Non-critical) |
| Version: | 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[2 May 2024 18:09]
OCA Admin
[2 May 2024 18:09]
OCA Admin
Contribution submitted via Github - Update charset/collation description indicate this is 16-bits, not 8-bits. (*) Contribution by Daniël van Eeden (Github dveeden, mysql-connector-python/pull/96#issuecomment-2088255362): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: git_patch_1849282515.txt (text/plain), 2.74 KiB.
[3 May 2024 6:08]
MySQL Verification Team
Hello Daniël, Thank you for the report and contribution. regards, Umesh
[3 May 2024 6:24]
Daniël van Eeden
Please make sure to consider the comment from Vladislav Vaintroub on GitHub when checking this: https://github.com/mysql/mysql-connector-python/pull/96#issuecomment-2091275230
[3 May 2024 6:37]
Daniël van Eeden
Note that there are two possibilities here:
1. Connector/Python is violating the protocol
This means:
- this is a bug in Connector/Python
- this invalidates my contribution to update the comments
- this means none of the connectors should send a collation that's more than 255 (1 byte)
- this means a COM_QUERY with `SET NAMES` is needed for collations >255.
For `latin1_bin` I've seen Connector/Python do this:
`SET NAMES 'latin1' COLLATE 'latin1_bin'`
`SET NAMES latin1`
This adds at least one roundtrip, maybe two. Not sure why there are two statements. The second one is only using the charset without quotes.
2a. Connector/Python is doing the right thing
This means:
- My contribution is valid
- The protocol docs are wrong or at least require an update
- The server should be made to read 2 bytes for collations
- The collation in this packet can be used to set the collation even if it is >255, without the need for `SET NAMES...`
2b. The protocol needs updating in a different way
This means:
- My contribution is invalid
- Connector/Python is violating the protocol
- The other byte of the collation should be send elsewhere in the protocol (not in the place where Connector/Python is putting it).
[3 May 2024 6:39]
Daniël van Eeden
Related: Bug #114818 Contribution: docs: multibyte collation for HandshakeResponse41
[11 Sep 2024 9:43]
Souma Kanti Ghosh
Posted by developer: Hello Daniël, Thank you for reporting this issue, your contribution helped a lot in fixing this one. Thanks and Regards, Souma Kanti Ghosh
[12 Sep 2024 20:11]
Philip Olson
Posted by developer: Fixed as of the upcoming MySQL Connector/Python 9.1.0 release, and here's the proposed changelog entry from the documentation team: The connector sent two bytes for the collation in the response packet, instead of one. Thank you for the bug report.
