[MDEV-13782] Issue about the operator NOT LIKE on connect-engine Created: 2017-09-11 Updated: 2019-11-27 Resolved: 2019-11-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.2.6, 10.2 |
| Fix Version/s: | 10.2.30, 10.3.21, 10.4.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Martin Francois | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows Server 2008, sql server |
||
| Issue Links: |
|
||||||||||||||||
| Description |
|
The "not like" operator don't work as expected, it don't return any data when it use trought the connect-engine while the "like" works well, and while on sql_server the exactly same sql query return data
so the table is on an remote server so when i try
but when i tried even a whatever query with NOT LIKE operator
I don't have any result while this query works well directly on the sqlserver if you need any more informations, feel free to ask them |
| Comments |
| Comment by Alice Sherepa [ 2017-09-12 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
please add a test case.
| |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-09-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
The difference is visible from the general log. On 10.1 this happens (11 is my client connection, and 12 is what CONNECT establishes):
But on 10.2 this happens (30 is my client connection, and 31 is what CONNECT establishes):
CONNECT adds an inverted clause to the query. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2017-09-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
I add the same results but could not fix it. Indeed CONNECT tries to add a where clause when possible and this is done when the cond_push function is called. This is tested in the code:
For the LIKE clause, condf->functype() returns LIKE_FUNC and a where clause is made. For the NOT LIKE clause the return of condf->functype() differs: Version 10.1 returns NOT_FUNC and CONNECT does not add a where clause.
However, this fix fails because the negated value is not set to true in the case of NOT LIKE. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-09-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
negated is set to true, you needed to add
but that wouldn't work, because negated is private in Item_func_like. This code needs some refactoring before you'll be able to access Item_func_like::negated | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2017-09-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Perhaps adding a virtual function isNegated() in Item_func so no casting would be required. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-11-19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
negated was made public in Now CONNECT can use it to generate the correct condition for pushing. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2019-11-19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
I just pulled the last 10.2.29 and 10.3.20 versions but could not fix this bug because negated is still private in Item_func_like and no get_negated() function exists in it. Temporarily, a (bad) fix was to comment out the LIKE case and return to what was done in older versions. LIKE queries are not filtered in ODBC (the all result set is returned so performance can be reduced) but the query is successfully filtered by MariaDB WHERE clause so the good result is obtained. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2019-11-26 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Sorry, pushed into 10.2 now. Commit 3551cd32a8df. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Olivier Bertrand [ 2019-11-27 ] | |||||||||||||||||||||||||||||||||||||||||||||||||
|
A true fix this time. |