Bug #77630 | Online Alter changing varchar column size error | ||
---|---|---|---|
Submitted: | 6 Jul 2015 13:16 | Modified: | 7 Jul 2015 13:57 |
Reporter: | Shahriyar Rzayev | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 5.7.7-rc | OS: | CentOS (7) |
Assigned to: | CPU Architecture: | Any |
[6 Jul 2015 13:16]
Shahriyar Rzayev
[6 Jul 2015 15:05]
MySQL Verification Team
also see http://bugs.mysql.com/bug.php?id=69148
[6 Jul 2015 15:07]
MySQL Verification Team
Hi! Thank you for your report. This does not look like a bug. If you have a VARCHAR column that is 86 characters long and you use UTF8 as a character set, you are already over the limit. Each character using UTF8 character set takes 3 bytes. You will find that info in our manual. So, 86 characters * 3 bytes / character = 258 bytes !!!! Hence, you are already above the limit. I hope that this is clear.
[7 Jul 2015 4:15]
Shahriyar Rzayev
When using ALGORITHM=INPLACE varchar "size" calculation is based on unicode for eg, it will take 3 bytes with UTF8 charset. Maybe not a bug but What about adding this into documentation? Documentation states -> "For VARCHAR values of 0 to 255, one length byte is required to encode the value. For VARCHAR values of 256 bytes or more, two length bytes are required" https://dev.mysql.com/doc/refman/5.7/en/innodb-create-index-overview.html#innodb-online-dd... https://dev.mysql.com/doc/refman/5.7/en/innodb-create-index-overview.html
[7 Jul 2015 13:57]
MySQL Verification Team
Sorry, but you have misunderstood the point. MySQL ALWAYS takes 3 bytes for a single UTF8 character, regardless of what command, statement or query is in question. Simply, in order to store every single UTF8 character, you need 3 bytes. As simple as that.