Bug #100511 MYSQL_FIELD length different when MySQL client and server version do not match
| Submitted: | 13 Aug 2020 9:17 | Modified: | 13 Aug 2020 13:16 |
|---|---|---|---|
| Reporter: | Sebastien FLAESCH | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | Connector / C | Severity: | S2 (Serious) |
| Version: | 8.0.19 | OS: | Debian (10) |
| Assigned to: | CPU Architecture: | x86 | |
| Tags: | MYSQL_FIELD length | ||
[13 Aug 2020 9:17]
Sebastien FLAESCH
[13 Aug 2020 12:32]
MySQL Verification Team
Hi Mr. FLAESCH, This bug is a duplicate of the bug #100401. Your report in the bug #100401 has been analysed by the experts that are working on the code and it was concluded that it is not a code bug, but documentation bug. Since this has been noted in our documentation, that bug is closed and so is this one.
[13 Aug 2020 13:16]
Sebastien FLAESCH
Please reconsider this: I think you don't understand the problem I describe here! The documentation update is about clarifying the fact that MYSQL_FIELD.length is expressed as a number of bytes and that it depends on the connection/client charset. This doc update is ok and welcome. However, the real issue is about getting a different MYSQL_FIELD.length when connecting from a MySQL client 8.0 to a MySQL server 5.7. Please find or setup a MySQL Client 8.0 env and MySQL Server 5.7 server and try to reproduce what I have reported here with simple SQL commands. What I experience in my C program is following. For a VARCHAR(25), with client charset defined as utf8mb4: Client 8.0 => Server 8.0 : length = 100 (25 * 4) => OK Client 5.7 => Server 5.7 : length = 100 (25 * 4) => OK Client 8.0 => Server 5.7 : length = 25 (25 * 1) => NOT OK This behavior IS NOT described in the documentation. I suspect that something is wrong because in the 8.0/5.7 config, the C API returns as expected a utf8mb4 charset in MY_CHARSET_INFO from mysql_get_character_set_info(), but MYSQL_FIELD.length is 25 bytes instead of 100 bytes for a VARCHAR(25) column. This is NOT consistent. Please just try with mysql command interpreter what I have reported here.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.044 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.