Bug #77631 | filter using trim results in correct | ||
---|---|---|---|
Submitted: | 6 Jul 2015 19:00 | Modified: | 20 Jul 2015 14:49 |
Reporter: | Son Nguyen | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S2 (Serious) |
Version: | 5.7 | OS: | Linux |
Assigned to: | Tor Didriksen | CPU Architecture: | Any |
[6 Jul 2015 19:00]
Son Nguyen
[15 Jul 2015 7:19]
Chiranjeevi Battula
Hello Son Nguyen, Thank you for the bug report. Verified this behavior on MySql Server 5.7.7 as described. Thanks, Chiranjeevi.
[15 Jul 2015 7:19]
Chiranjeevi Battula
Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.7.7-rc-enterprise-commercial-advanced-log MySQL Enterprise Ser ver - Advanced Edition (Commercial) Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use test; Database changed mysql> select `COUNTRY` from `COUNTRY` where trim(leading 'A' from `COUNTRY`) = 'ustralia'; +-----------+ | COUNTRY | +-----------+ | Australia | +-----------+ 1 row in set (0.00 sec) mysql> select `COUNTRY` from `COUNTRY` where trim(trailing 'a' from `COUNTRY`) = 'Australi'; +-----------+ | COUNTRY | +-----------+ | Australia | +-----------+ 1 row in set (0.00 sec) mysql> select `COUNTRY` from `COUNTRY` where trim(leading 'A' from `COUNTRY`) = 'ustralia' or trim(trailing 'a' from `COUNTRY`) = 'Australi'; +-----------+ | COUNTRY | +-----------+ | Australia | +-----------+ 1 row in set (0.00 sec) mysql> select `COUNTRY` from `COUNTRY` where trim(leading 'A' from `COUNTRY`) = 'ustralia' and trim(trailing 'a' from `COUNTRY`) = 'Australi'; Empty set (0.00 sec) mysql>
[20 Jul 2015 14:49]
Paul DuBois
Noted in 5.7.9, 5.8.0 changelogs. A WHERE predicate containing both TRIM(LEADING ..) and TRIM(TRAILING ...) could be incorrectly optimized away.