Bug #7267
CompoundQuery FOR FIRST, EACH only retrieves the first record found
100%
History
#1 Updated by Dănuț Filimon over 3 years ago
There is a problem with CompoundQuery where using FOR FIRST, EACH will only return the first record available, ignoring the rest of the records from the second table. I found it while testing 7185a/rev.14530 and it is still present in trunk/rev.14530.
Test case:
DEFINE TEMP-TABLE tt1 FIELD f1 AS INTEGER.
DEFINE TEMP-TABLE tt2 FIELD f1 AS INTEGER.
CREATE tt1.
tt1.f1 = 5.
CREATE tt2.
tt2.f1 = 1.
CREATE tt2.
tt2.f1 = 2.
FOR FIRST tt1, EACH tt2.
MESSAGE tt1.f1 tt2.f1.
END.
4GL Output:
5 1 5 2
FWD Output:
5 1
#2 Updated by Constantin Asofiei over 3 years ago
Eric: this looks like the same #7229 problem.
#3 Updated by Constantin Asofiei over 3 years ago
Danut: the patch would be this, please test it, in CompoundQuery$Optimizer.isServerJoinPossible - the point is, a NEXT component is not allowed to be attached to a group which has only 'single' components.
case NEXT:
if (mixed && parentIteration != NEXT)
{
// mixed iteration types should be contiguous to simplify the sorting
if (fine)
{
log.fine(" --- non-contiguous iteration types");
}
return false;
}
else if (countSingle > 0 && countMulti == 0 && iteration == NEXT)
{
if (fine)
{
log.fine(" --- NEXT can't follow FIRST/LAST/UNIQUE");
}
return false;
}
#4 Updated by Dănuț Filimon over 3 years ago
Constantin Asofiei wrote:
Danut: the patch would be this, please test it, in CompoundQuery$Optimizer.isServerJoinPossible - the point is, a NEXT component is not allowed to be attached to a group which has only 'single' components.
The patch works. Thank you for your explanation.
#6 Updated by Alexandru Lungu about 3 years ago
- Status changed from New to WIP
- % Done changed from 0 to 100
#7 Updated by Alexandru Lungu about 3 years ago
- Status changed from WIP to Review
#8 Updated by Alexandru Lungu about 3 years ago
- Status changed from Review to Test
This can be closed/rejected.