[MDEV-17226] Column Data in Truncated on UNION to the length of the first value if using REPLACE Created: 2018-09-18 Updated: 2023-12-11 Resolved: 2023-12-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.0, 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.5.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | Robert Humphries | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | upstream | ||
| Environment: |
Tested on: |
||
| Issue Links: |
|
||||||||
| Description |
|
When you do a UNION, where at least one of the queries has a replace on the value SELECTed, then the returned values are truncated to the length of the smallest value. This only seems to occur when the length of the columns being selected from the table are equal. Please see the test script for some examples. For each query, if you run the query that is truncated as a simple query (instead of in the union) it returns the correct result. This is an issue in MySQL version 8 as well.
|
| Comments |
| Comment by Elena Stepanova [ 2018-10-03 ] | ||||||||||||||||||||||
|
Thanks for the report. | ||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-08-06 ] | ||||||||||||||||||||||
|
Repeatable as described:
Notice, data in the second SELECT query was truncated. | ||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-08-06 ] | ||||||||||||||||||||||
|
It seems REPLACE() does not calculate its max length well. This script demonstrates the problem:
| ||||||||||||||||||||||
| Comment by Alexander Barkov [ 2023-12-08 ] | ||||||||||||||||||||||
|
This problem was fixed in 10.5 by:
|