8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 15:23:03 +01:00

Fix #8304 - Wrong results using minvalue/maxvalue in join condition.

This commit is contained in:
Adriano dos Santos Fernandes 2024-11-03 21:23:02 -03:00
parent d53f3681ac
commit 1c3dc43935

View File

@ -5470,19 +5470,22 @@ dsc* evlMakeDbkey(Jrd::thread_db* tdbb, const SysFunction* function, const NestV
dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, const NestValueArray& args,
impure_value*)
impure_value* impure)
{
fb_assert(args.getCount() >= 1);
fb_assert(function->misc != NULL);
Request* request = tdbb->getRequest();
dsc* result = NULL;
const auto request = tdbb->getRequest();
HalfStaticArray<const dsc*, 2> argTypes(args.getCount());
dsc* result = nullptr;
for (FB_SIZE_T i = 0; i < args.getCount(); ++i)
{
dsc* value = EVL_expr(tdbb, request, args[i]);
const auto value = EVL_expr(tdbb, request, args[i]);
if (request->req_flags & req_null) // return NULL if value is NULL
return NULL;
return nullptr;
argTypes.add(value);
if (i == 0)
result = value;
@ -5506,7 +5509,12 @@ dsc* evlMaxMinValue(thread_db* tdbb, const SysFunction* function, const NestValu
}
}
return result;
DataTypeUtil(tdbb).makeFromList(&impure->vlu_desc, function->name, argTypes.getCount(), argTypes.begin());
impure->vlu_desc.dsc_address = (UCHAR*) &impure->vlu_misc;
MOV_move(tdbb, result, &impure->vlu_desc);
return &impure->vlu_desc;
}