sonar-openedge icon indicating copy to clipboard operation
sonar-openedge copied to clipboard

WHOLE-INDEX on Temp-Table on FOR EACH <temp-table> with a join

Open gquerret opened this issue 3 years ago • 0 comments

On behalf of SMIT (reported some time ago)

It seems that I have found an issue, which is related to https://github.com/Riverside-Software/sonar-openedge/issues/116 and https://github.com/Riverside-Software/sonar-openedge/issues/100.

When there are two temp-tables joined, then Sonar still reports a simple FOR EACH as “WHOLE-INDEX search on table ttTableOne - Index used: ttTableOne.primaryKey”.

Code to reproduce:

DEFINE TEMP-TABLE ttTableOne NO-UNDO
    FIELD tableId      AS INTEGER
    INDEX pk           IS PRIMARY UNIQUE tableId.
 
DEFINE TEMP-TABLE ttTableTwo NO-UNDO
    FIELD tableId      AS INTEGER
    FIELD tableOneId   AS INTEGER
    INDEX fk           tableOneId.

FOR EACH ttTableOne:
    /* just iterating */
END.

FOR EACH ttTableOne,
    EACH ttTableTwo
    WHERE ttTableTwo.tableOneId = ttTableOne.tableId:
    /* just iterating */
END.

Only the second FOR EACH is reported by Sonar, not the first one: image

The same issue is reported in the Sonar web report, so it is not just a SonarLint issue. We are using OpenEdge plugin 2.14.9.

gquerret avatar Oct 03 '22 19:10 gquerret