Bug #10689
Wrong temp-table FOR EACH sorting criteria
100%
Related issues
History
#1 Updated by Teodor Gorghe 10 months ago
- Related to Bug #9267: Index Selection in case of a multiple index matches. added
#3 Updated by Teodor Gorghe 10 months ago
The following test case fails on FWD because of the unimplemented main index selection by definition:
BLOCK-LEVEL ON ERROR UNDO, THROW.
USING OpenEdge.Core.Assert FROM PROPATH.
CLASS tests.TestTempTableSort:
DEFINE TEMP-TABLE tt1 NO-UNDO
FIELD f1 AS INTEGER
FIELD f2 AS CHARACTER
FIELD f3 AS CHARACTER
FIELD f4 AS CHARACTER
INDEX idx1 f1 f2 f3
INDEX aidx2 f1 f2 f4.
@Test.
METHOD PUBLIC VOID TestIdx1():
DEFINE VARIABLE i AS INTEGER NO-UNDO INITIAL 1.
EMPTY TEMP-TABLE tt1.
CREATE tt1.
ASSIGN
tt1.f1 = 1
tt1.f2 = '1'
tt1.f3 = '2'
tt1.f4 = '1'.
CREATE tt1.
ASSIGN
tt1.f1 = 1
tt1.f2 = '1'
tt1.f3 = '1'
tt1.f4 = '2'.
RELEASE tt1.
FOR EACH tt1:
Assert:Equals(STRING(i), tt1.f3).
i = i + 1.
END.
END METHOD.
END CLASS.
╷
├─ JUnit Jupiter ✔
├─ JUnit Vintage ✔
├─ JUnit Platform Suite ✔
└─ FWD Test ✔
└─ tests.TestTempTableSort ✔
└─ testIdx1 ✘ Expected: 1 but was: 2
4GL selects the index by the order of definition on temp-table, but FWD selects the index by definition name (by alphabetical order).
#4 Updated by Eduard Soltan 10 months ago
- File Index-rules.png added

From this list, the only thing left to implement is temp-tables go by definition order
#5 Updated by Teodor Gorghe 10 months ago
- Assignee set to Teodor Gorghe
- Status changed from New to WIP
Created task branch 10689a.
#6 Updated by Teodor Gorghe 10 months ago
- % Done changed from 0 to 100
- Status changed from WIP to Review
- reviewer Constantin Asofiei added
Committed revision 16213 on task branch 10689a:
- Improved index selection for temp-table: added implementation temp-tables go by definition order.
#7 Updated by Teodor Gorghe 10 months ago
- File book.df added
There is also this test case, which passes on 4GL, but fails on FWD:
BLOCK-LEVEL ON ERROR UNDO, THROW.
USING OpenEdge.Core.Assert FROM PROPATH.
CLASS tests.TestWorkTableQuery:
@Setup.
METHOD PUBLIC VOID Setup():
CREATE book.
ASSIGN
book.f1 = 1
book.f2 = '2'
book.f3 = '3'
book.f4 = 'b'.
book.f5 = '1'.
CREATE book.
ASSIGN
book.f1 = 1
book.f2 = '2'
book.f3 = '3'
book.f4 = 'a'.
book.f5 = '2'.
END METHOD.
@Test.
METHOD PUBLIC VOID TestMainIndex():
DEFINE VARIABLE cExpected AS CHARACTER EXTENT 2 NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO INITIAL 1.
cExpected[1] = 'b'.
cExpected[2] = 'a'.
FOR EACH book WHERE book.f1 = 1 AND book.f2 = '2' AND book.f3 = '3':
Assert:Equals(cExpected[i], book.f4).
i = i + 1.
END.
END METHOD.
@Teardown.
METHOD PUBLIC VOID Teardown():
FOR EACH book:
DELETE book.
END.
END METHOD.
END CLASS.
I think the index selection for this is right (second index must be selected), but on FWD, the second record somehow gets selected first.
#8 Updated by Teodor Gorghe 10 months ago
Teodor Gorghe wrote:
There is also this test case, which passes on 4GL, but fails on FWD:
[...]I think the index selection for this is right (second index must be selected), but on FWD, the second record somehow gets selected first.
Issue fixed on 10480a, no fix required in this task.
#9 Updated by Constantin Asofiei 9 months ago
- check copyright year and set it to 2025
Schema record type ({@link #TEMP_TABLE} or {@link #WORK_TABLE}).- this is not completely right - you can have TABLE or BUFFER here, too. Where TABLE is for a .df table, and BUFFER can be for both. Also,WORK_TABLEAFAIK can not define indexes. ThusbreakTieWorkTableshould be renamed back tobreakTieRecordPhraseData.recordTypehas no javadoc.
#10 Updated by Teodor Gorghe 9 months ago
Committed revision 16214 on task branch 10689a:
- Addressed code review #10689-9.
Committed revision 16215 on task branch 10689a:
- Fix history entry.
#11 Updated by Constantin Asofiei 6 months ago
- Status changed from Review to Internal Test
#12 Updated by Teodor Gorghe 6 months ago
Rebased to trunk rev 16358
#13 Updated by Constantin Asofiei 6 months ago
- Status changed from Internal Test to Merge Pending
Merge to trunk after 10636a
#14 Updated by Teodor Gorghe 6 months ago
- Status changed from Merge Pending to Test
Branch 10689a was merged to trunk rev. 16386 and archived.
#15 Updated by Constantin Asofiei 6 months ago
- Status changed from Test to Closed