[MDEV-9368] Improper result returned when using escaped backslash in query using like Created: 2016-01-05 Updated: 2016-06-20 Resolved: 2016-06-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Character Sets |
| Affects Version/s: | 5.3.13, 5.5, 10.0, 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Christian Schmid | Assignee: | Alexander Barkov |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7 |
||
| Sprint: | 10.0.26 |
| Description |
|
When using the LIKE operator on a varchar column an inproper result is returned if the data contains non standard ASCII chars (e.g. german umlauts). Steps to reproduce
Insert dummy data:
Perform query:
Actual Result
Expected Result
Further Information / Hints
|
| Comments |
| Comment by Elena Stepanova [ 2016-01-10 ] | ||||||||||||||||||||||||||||||||||||||||
|
Thanks for the report and the test case. In fact, it works the same way on current MySQL. Maybe you had different character set values on that server, so it wasn't reproducible (apparently, it happens with utf8, but not latin1).
| ||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2016-06-16 ] | ||||||||||||||||||||||||||||||||||||||||
|
This script:
returns
This is wrong. | ||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2016-06-16 ] | ||||||||||||||||||||||||||||||||||||||||
|
The problem is repeatable with the equality operator as well:
The reason for that is that latin1_swedish_ci is defined the way that '\' is equal to 'ä'. We cannot change latin1_swedish_ci at this point, as it will bring heavy upgrade problems. Please use this workaround:
It correctly returns the expected result:
|