Conversation
gkodinov
requested changes
Sep 28, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
One general note on the commit message: please do not summarize the changes done.
Good commit messages usually follow the following pattern:
- what was wrong exactly
- how it was fixed
- how was the fix tested.
Item_cache_int::val_real() converts the stored integer to DOUBLE as a signed value even when unsigned_flag is set. Values above LLONG_MAX therefore become negative. A BETWEEN comparison using a cached ~TRUE bound can then discard a row that should match an IS FALSE predicate. Interpret unsigned cached bits as ulonglong before converting to DOUBLE, using unsigned_flag to select the correct conversion. Add a BETWEEN query with a bitwise complement and a VARCHAR column to func_bit. Use two rows so constant-table optimization cannot bypass the cache. Check that zero lies below the unsigned lower bound for both rows. Bug report: https://jira.mariadb.org/browse/MDEV-40089
DerZc
force-pushed
the
fix-mdev-40089
branch
from
September 29, 2026 06:21
dd69f61 to
66620bc
Compare
gkodinov
approved these changes
Sep 29, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
LGTM. Thanks! Please stand by for the final review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item_cache_int::val_real() interprets stored unsigned bits as a signed integer before converting to DOUBLE. Values above LLONG_MAX become negative, so a BETWEEN predicate using a cached ~TRUE bound can wrongly discard rows.
Use unsigned_flag to convert unsigned cached values through ulonglong before converting to DOUBLE.
Regression coverage
Add one query to
main.func_bitwith a bitwise complement and a VARCHAR column. Two rows prevent constant-table optimization from bypassing the cache. Both should satisfy IS FALSE because zero is below the unsigned lower bound; ORDER BY makes the result deterministic.The five-line test needs no InnoDB prerequisite, SET, database creation, manual prepared statements or duplicate queries. Existing test prerequisites remain unchanged, and MTR supplies prepared-statement and view protocol coverage.
Validation
On current
11.4atf49e838d367f2154b3edb43effa99ff9eb0d8602:main.func_bitonly on the new query, returning no rows instead of0and1.main.func_bit,main.select,main.type_bit,main.type_bit_innodb,main.type_decimalandmain.type_floatpass.main.func_bitpasses.main.func_bitpasses.Bug report: https://jira.mariadb.org/browse/MDEV-40089