Bug #10374
Issues revealed while running testcases
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:
0%
billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:
History
#1 Updated by Ovidiu Maxiniuc 12 months ago
These are some issues which I encountered while testing MSSQL dialect but found to affect others, as well. I did not go too deep on them so I cannot decide at this moment if they are classified as persistence/database, runtime or even conversion.
- Primary index not used
I do not recall the exact mechanism for picking the right one, but it seems that we may have a problem. The classicbooktable has 5 indexes:book-id(primary),author-id,isbn,pub-date, andpublisher. If no sorting order is specified, 4GL seems to use the primary one (naturally). However, FWD emits them in following order (in schema_index.sql):idx__book_isbn,idx__book_book_id,idx__book_author_id,idx__book_pub_date,idx__book_publisher. This may be irrelevant, but at runtime, a query like
will convert toFIND FIRST book WHERE (book.book-id EQ 1) = (book.isbn EQ '1') LOCK NO-ERROR.
Since thenew FindQuery(book, "(book.bookId = 1) = (upper(book.isbn) = '1')", null, "book.isbn asc", LockType.NONE).silentFirst();idx__book_isbnwill be used, the result is different (same for MSSQL and PSQL) - Case-sensitivity in queries
It looks to me that we do not correctly honour the case insensitivity in where expressions. The following statement
is converted asFIND FIRST book WHERE STRING(book.isactive AND book.isactive2) EQ "yes" NO-LOCK NO-ERROR.
Note thenew FindQuery(book, "toString(book.isactive = true and book.isactive2 = true) = 'YES'", null, "book.bookId asc", LockType.NONE).silentFirst();"yes"literal was uppercased in order to facilitate the case-insensitive test, but there is noupper()injected to the left side of=operator. SincetoString()operator will return a lowercase string, the compare operation will fail on a CS collation. Shouldupperbe injected at runtime, in preprocessor, maybe? (Tested with MSSQL with CS collation and PSQL. MSSQL with CI collation works correctly).