1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-30710 Incorrect operator when comparing large unsigned integers.

When constructing a SEL_TREE, an unsigned integer greater than
its signed equivalent caused an incorrect comparison operator to
be chosen.
This commit is contained in:
Rex
2023-07-19 15:59:33 +11:00
parent 1a5c4c2d9b
commit f17a865c39
3 changed files with 22 additions and 1 deletions

View File

@@ -8995,7 +8995,8 @@ SEL_ARG *Field::stored_field_make_mm_leaf_bounded_int(RANGE_OPT_PARAM *param,
DBUG_RETURN(new (param->mem_root) SEL_ARG_IMPOSSIBLE(this));
longlong item_val= value->val_int();
if (op == SCALAR_CMP_LT && item_val > 0)
if (op == SCALAR_CMP_LT && ((item_val > 0)
|| (value->unsigned_flag && (ulonglong)item_val > 0 )))
op= SCALAR_CMP_LE; // e.g. rewrite (tinyint < 200) to (tinyint <= 127)
else if (op == SCALAR_CMP_GT && !unsigned_field &&
!value->unsigned_flag && item_val < 0)