[MDEV-8402] Bug #77473 Truncated data with subquery & UTF8 Created: 2015-06-30 Updated: 2016-06-29 Resolved: 2016-06-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Character Sets |
| Affects Version/s: | 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.50, 10.0.26, 10.1.15 |
| Type: | Bug | Priority: | Major |
| Reporter: | Hartmut Holzgraefe | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | upstream-fixed | ||
| Sprint: | 5.5.50 |
| Description |
|
REPEAT() and RPAD() results in a subquery get truncated if the length parameter is between 32768 and 65536 for 2-byte UTF-8 sequences, or between 21845 and 65535 . Below and above that point the result is correct.
This is not a problem of the length function in the outer query, it is already the string returned from the inner query that gets truncated as can be seen with
Looks as if the intermediate result length is calculated by character count and not by byte length, and so the wrong data type seems to be used to store the intermediate result. E.g. when using a unicode character that has a 3 byte UTF-8 representation:
|
| Comments |
| Comment by Hartmut Holzgraefe [ 2015-06-30 ] | ||||||||||||||||
|
Upstream bug is http://bugs.mysql.com/77473 | ||||||||||||||||
| Comment by Elena Stepanova [ 2015-07-01 ] | ||||||||||||||||
|
There is also a warning issued when the problem occurs. In the output below, the third result is erroneous.
| ||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2016-03-07 ] | ||||||||||||||||
|
Oracle fix is here: https://github.com/mysql/mysql-server/commit/03cb5110c701afa43ddea082998ee6a54e731bf6 | ||||||||||||||||
| Comment by Elena Stepanova [ 2016-03-07 ] | ||||||||||||||||
|
Fixed in 5.7, see the commit above. |