[MDEV-29937] GROUP_CONCAT incomplete, not near group_concat_max_len. Created: 2022-11-02 Updated: 2023-11-28 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.5.13, 10.3.36, 10.5.17 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Brian | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
See below. The GROUP_CONCAT is missing the last two characters.
Just the CONCAT is fine:
This was initially hit with real data in column type float, but above is same issue with no need for the table. The conv() is needed to get original float values. Just selecting them the two print the same. |
| Comments |
| Comment by Daniel Black [ 2022-11-03 ] | ||||||||||||||||||||||||||
|
When real number is pushed to the string buffer the 39 decimals is used (rather than the 23 max_length).
The 23 maximum is determined by:
Given "-0.0000067628410249653825" is 25 characters this is the correct length (or should it be truncated to 23?)
Causes test failures main.ctype_utf8 main.ctype_binary main.ctype_cp1251 main.func_hybrid_type main.func_math main.ctype_latin1 main.ctype_ucs main.type_num as the raised with of the tables There are other DBL_DIG+8 or instances in the code. bar, what's rthe right fix here? Increase the float length by 2 or constrain the Item_func_hybrid_field_type::val_str_from_real_op / String->set_real length? | ||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2022-11-17 ] | ||||||||||||||||||||||||||
|
It seems Item_func_concat erroneously calculates its max_length in fix_length_and_dec().
The expected data type should be at least varchar(30). | ||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2022-11-17 ] | ||||||||||||||||||||||||||
|
A similar problem is repeatable with this script:
| ||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2022-11-17 ] | ||||||||||||||||||||||||||
|
A similar problem is repeatable with this script:
| ||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2022-11-17 ] | ||||||||||||||||||||||||||
|
In all cases String::set_real() is called to perform double-to-string conversion, which produces a longer string than Item::max_length calculated. This looks wrong. We probably need to use something else than String::set_real(), to take into account max_length. Or we need to calculate max_length differently, to guarantee that any possible String::set_real() output fits. |