8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 10:00:38 +01:00

Fixed #8033: Invalid result when string compared with indexed numeric(x,y) field where x > 18 and y != 0

This commit is contained in:
AlexPeshkoff 2024-03-06 14:15:36 +03:00
parent 96ef319bc9
commit f2c5bb6811
3 changed files with 15 additions and 7 deletions

View File

@ -223,7 +223,7 @@ public:
MetaName* irb_name; // Index name
ValueExprNode** irb_value; // Matching value (for equality search)
LookupValueList* irb_list; // Matching values list (for IN <list>)
SSHORT* irb_scale; // Scale for int64 key
SSHORT* irb_scale; // Scale for int64/int128 key
};
// Flag values for irb_generic

View File

@ -607,7 +607,7 @@ struct IndexScratchSegment
bool excludeUpper = false; // exclude upper bound value from scan
unsigned scope = 0; // highest scope level
segmentScanType scanType = segmentScanNone; // scan type
SSHORT scale = 0; // scale for SINT64 (idx_numeric2) index
SSHORT scale = 0; // scale for SINT64/Int128-based segment of index
MatchedBooleanList matches; // matched booleans
};
@ -625,8 +625,8 @@ struct IndexScratch
unsigned lowerCount = 0;
unsigned upperCount = 0;
unsigned nonFullMatchedSegments = 0;
bool usePartialKey = false; // Use INTL_KEY_PARTIAL
bool useMultiStartingKeys = false; // Use INTL_KEY_MULTI_STARTING
bool usePartialKey = false; // Use INTL_KEY_PARTIAL
bool useMultiStartingKeys = false; // Use INTL_KEY_MULTI_STARTING
bool useRootListScan = false;
Firebird::ObjectsArray<IndexScratchSegment> segments;

View File

@ -1944,9 +1944,17 @@ bool Retrieval::matchBoolean(IndexScratch* indexScratch,
return false;
}
// Scale idx_numeric2
if ((!missingNode) && (matchDesc.dsc_dtype == dtype_int64))
segment->scale = matchDesc.dsc_scale;
// Scale for big exact numerics
if (!missingNode)
{
switch (matchDesc.dsc_dtype)
{
case dtype_int64:
case dtype_int128:
segment->scale = matchDesc.dsc_scale;
break;
}
}
// A match could be made
if (segment->scope < scope)