Bug #10830
Search filter field on Guests screen of Hotel GUI does not work.
0%
Related issues
History
#1 Updated by Sergey Ivanovskiy 9 months ago

Fill 'C' into Filter by Guest and press Search:

then reset filters and fill 'Ch' into Filter by Guest and press Search:

The result set is empty but it is not expected.
Place the input focus into Filter by Guest and try keyboard navigation with Left and Right keys but the cursor is not moved.
#2 Updated by Sergey Ivanovskiy 9 months ago
This issue was found while testing 10234b (#10234).
#3 Updated by Sergey Ivanovskiy 9 months ago
- File GuestsScreenWithFilterApplied3.png added
#4 Updated by Sergey Ivanovskiy 9 months ago
- File deleted (
GuestsScreenWithFilterApplied3.png)
#6 Updated by Ovidiu Maxiniuc 8 months ago
I did a quick investigation on this issue.
The problematic code is:
guest.first-name + " " + guest.last-name MATCHES guestNameconverted into (H2 dialect) SQL as
concat_1(concat_1(guest__imp0_.first_name, ' '), guest__imp0_.last_name) like ?where the parameter is computed as
upper('%' + pattern + '%'), in this case %CH%.
The problem is the implementation of concat UDF in H2. More precisely, the fact that it returns a ValueString (case sensitive), while the entered value is treated as case-insensitive and uppercased. In this case, only names with uppercased CH substring would be found, but there is none in the default hotel database. In 4GL, the return of such function will preserve the case-sensitivity and return a character instance of same type, the default being case-insensitive.
Another example is the search for I. A single record is found, although half of the guest have this letter in their name.
I think this is not the only UDF with the same flaw. And, momentarily, I do not know how to fix it. The method is defined in Functions class as:
@HQLFunction
public static String concat(String a, String b)The expected type should be ValueStringIgnoreCase (I think this was added in our forked H2 build) and we do not have a mean to communicate this with H2.
A (useless) 4GL workaround for this issue is to uppercase the both operands of like.
#7 Updated by Sergey Ivanovskiy 8 months ago
- Assignee set to Ovidiu Maxiniuc
#8 Updated by Alexandru Lungu 8 months ago
- Status changed from New to WIP
- Assignee changed from Ovidiu Maxiniuc to Alexandru Lungu
There is FunctionAlias$JavaMethod that has a c'tor considering defaultIgnoreCase. If set to true, the string data types are automatically returned as ignore-case.
I can pick up this task.
#9 Updated by Constantin Asofiei 8 months ago
- Related to Bug #10920: String concatenation doesn't work in WHERE clause for permanent databases added
#10 Updated by Constantin Asofiei 8 months ago
Please see #10920.
#11 Updated by Alexandru Lungu 8 months ago
Does the fix there also fix #10830?
#12 Updated by Constantin Asofiei 8 months ago
It fixes both #10914 and this.