MDEV-38752: Wrong result upon GROUP BY on a table with indexed virtual column after INSERT IGNORE#4759
MDEV-38752: Wrong result upon GROUP BY on a table with indexed virtual column after INSERT IGNORE#4759kjarir wants to merge 2 commits intoMariaDB:12.3from
Conversation
aa9523d to
1002ee1
Compare
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
Please rebase to 12.3: this is a bug fix and it needs to cover all affected versions
| --echo # 'apple' and 'apricot' both truncate to 'apple' in va | ||
| --echo # Should return 3 rows | ||
| SELECT a, va, COUNT(*) FROM t3 GROUP BY a; | ||
| DROP TABLE t3; |
There was a problem hiding this comment.
we customarily end tests with a print like that:
--echo End of ... tests.
There was a problem hiding this comment.
Please also make sure all of the related failing tests are re-recorded.
There was a problem hiding this comment.
@kjarir note this is --echo End of 12.3 tests rather the test name.
05fd327 to
b33ef30
Compare
|
|
21e3d7f to
7bf01fe
Compare
…l column after INSERT IGNORE
7bf01fe to
17e3155
Compare
Description
This PR fixes MDEV-38752, a regression introduced in commit
8cdee25952763a0401e4c2a4d61e92c13499bdc6.The issue was caused by the optimizer incorrectly substituting expressions in
GROUP BYorORDER BYwith indexed virtual columns that had "narrower" data types (e.g., substituting anINTexpression with aTINYINTvirtual column). After anINSERT IGNORE, data truncation in the virtual column caused distinct values from the original expression to merge into a single group in the query result.Changes
max_lengthand decimals are sufficient to cover the expression's range without truncation.Testing