| Bug #80227 | Func SUBSTRING_INDEX works incorrectly with negative count | ||
|---|---|---|---|
| Submitted: | 2 Feb 2016 4:24 | Modified: | 2 Feb 2016 6:18 |
| Reporter: | Su Dylan | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.7.8, 5.7.10, 5.6.28, 5.5.48 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[2 Feb 2016 6:18]
MySQL Verification Team
Hello Su Dylan, Thank you for the report and test case. Observed that 5.5.48, 5.6.28 and 5.7.10 are affected. Thanks, Umesh
[2 Feb 2016 7:44]
Tor Didriksen
Posted by developer:
5.1 is also affected
select substring_index('aaab','aa',-1);
substring_index('aaab','aa',-1)
b
set names utf8;
select substring_index('aaab','aa',-1);
substring_index('aaab','aa',-1)
ab

Description: Output: ===== mysql> select substring_index('aaab','aa',-1); +---------------------------------+ | substring_index('aaab','aa',-1) | +---------------------------------+ | ab | +---------------------------------+ 1 row in set (0.00 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.7.8-rc | +-----------+ 1 row in set (0.00 sec) Problem: ===== 'b' is expected. How to repeat: select substring_index('aaab','aa',-1); Suggested fix: 'b' is returned.