temp-table defined without unique index

Project:Prolint Issue Tracker
Component:Rules
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I have been searching for a full week :!: trying to figure out why a particular program was slowing down. In the end, the problem appeared to be a stupid little typo in an assign statement, that caused duplicate records to be created in a temp-table. Something like this:

Code:

FOR EACH .....
   FIND FIRST tt_table WHERE tt_table.idnr = someNumber NO-ERROR.
   IF NOT AVAILABLE tt_table THEN DO:
       CREATE tt_table.
       ASSIGN 
           tt_table.idnr  = sameNumber
           tt_table.text  = someText.
   END.
END.

Well it wasn't exactly like this but you get the idea.... sameNumber is 0 so a lot of identical records are created. This temp-table was supposed to hold only a small number of records, but instead it would grow to 100000 identical records because each FIND failed.

If this little temp-table would have had a unique index, the program would have simply raised a run-time error at the second attempt and it would not have cost me a week to overlook this stupid typo.