Bug #106701 | Contribution: Fix bug in REPLACE() in UNION truncates result | ||
---|---|---|---|
Submitted: | 11 Mar 2022 0:01 | Modified: | 11 Mar 2022 7:25 |
Reporter: | OCA Admin (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | Contribution |
[11 Mar 2022 0:01]
OCA Admin
[11 Mar 2022 0:01]
OCA Admin
Contribution submitted via Github - Fix bug in REPLACE() in UNION truncates result (*) Contribution by Nick Belyavski (Github nickcoast, mysql-server/pull/390#issuecomment-1064447106): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: git_patch_873834034.txt (text/plain), 5.05 KiB.
[11 Mar 2022 7:25]
MySQL Verification Team
Hello Nick Belyavski, Thank you for the report and contribution. regards, Umesh
[12 Mar 2022 10:30]
huahua xu
It may be better to fix this bug like: ulonglong char_length = args[0]->max_char_length(collation.collation); + ulonglong search_length = args[1]->max_char_length(collation.collation); ulonglong replace_length = args[2]->max_char_length(collation.collation); + int diff = (int) (replace_length - search_length); - if (replace_length > 1ULL) { - char_length = char_length * (replace_length - 1ULL); + if (diff > 0 && search_length >= 1ULL) { + ulonglong max_substrs = char_length / search_length + char_length += max_substrs * (uint) diff; } set_data_type_string(char_length);
[17 Mar 2022 23:56]
Nick Belyavski
xu huahua Nice! Same math, it seems, but easier to read than mine, and you improved my 'if' condition.
[5 Apr 2022 21:17]
OCA Admin
Contribution submitted via Github - Bug #106701: Fix REPLACE() in UNION truncates result (*) Contribution by Nick Belyavski (Github nickcoast, mysql-server/pull/395#issuecomment-1089272147): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: git_patch_895090566.txt (text/plain), 6.59 KiB.