[MDEV-29646] sformat('Num [{:20}]', 42) gives incorrect result in view Created: 2022-09-27 Updated: 2023-06-07 Resolved: 2023-05-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lena Startseva | Assignee: | Daniel Black |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | beginner-friendly, view-protocol | ||
| Issue Links: |
|
||||||||
| Description |
|
Test:
Expected result:
Actual result:
|
| Comments |
| Comment by Oleksandr Byelkin [ 2022-11-29 ] | |||||||||||||||||||||
|
It is not a problem of view print:
| |||||||||||||||||||||
| Comment by Weijun Huang [ 2023-02-26 ] | |||||||||||||||||||||
|
| |||||||||||||||||||||
| Comment by Weijun Huang [ 2023-02-26 ] | |||||||||||||||||||||
|
I have discovered a bug in `mariadbd` at `Field_varstring::store(this=0x00000001050eb6a0, from="Num [ 42]", length=15, cs=0x0000000101a23f88)` in the `field.cc` file at line 7872, column 3. The issue is that the `Field_varstring.field_length` value, 12, is smaller than the length of the string, which is causing the error. I have attempted to modify the `field_length` parameter to resolve the issue, but I have been unsuccessful so far. | |||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-03-26 ] | |||||||||||||||||||||
|
Item_func_sformat determines the max length of the result as a sum of max length of its arguments:
this, of course, makes little sense, because the length of the result can be anything, depending on the format string. | |||||||||||||||||||||
| Comment by Daniel Black [ 2023-05-04 ] | |||||||||||||||||||||
|
Thanks Weijun Huang. Note Fix Versions may be incorrect. Merged to 10.8 however bb-10.8-release is created and no alternate version exist in JIRA yet. |