Salesforce

When a FOR EACH uses TABLE-SCAN, the next query which uses a normal index will get also the table-scan option

« Go Back

Information

 
TitleWhen a FOR EACH uses TABLE-SCAN, the next query which uses a normal index will get also the table-scan option
URL Name000052465
Article Number000111737
EnvironmentProduct: OpenEdge
Version: 11.3.1, 11.3.2, 11.4.x
OS: All supported platforms
Question/Problem Description
If the TABLE-SCAN option for a query is used to get all entries of a table without an index, the next query which uses a normal index will also use the TABLE-SCAN option 

When a FOR EACH uses TABLE-SCAN, the next query the index that the compiler would have normally picked is still compiled with the table-scan option 

The next query only has the table-scan when the first query in the code is FIND FIRST. For an example please refer to the attached procedure file.
Steps to Reproduce
Clarifying Information
Error Message
Defect NumberDefect PSC00310786.
Enhancement Number
Cause
This issue only affects uncompliled code:
When the first code is compiled, the TABLE-SCAN flag is set.
When the next query is compiled, if the buffer is already in scope it is reused and still has TABLE-SCAN in effect which means it is compiled incorrectly instead of using the the index that the compiler would have normally picked
Resolution
Upgrade to OpenEdge 11.3.3, 11.5.0 or later. Where the tbl_scan flag is reset before we return to compile the next code statement.
Workaround
As a workaround you can define a special buffer for the table or the temp table and use this buffer in the query with the table-scan option. 

An implementation would look similar to this:
 
DEFINE BUFFER <buffer-name> FOR <tt-name>.

FOR EACH <buffer-name> TABLE-SCAN NO-LOCK:
   ...
END.

 
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:32 AM

Powered by