[MCOL-2233] SUBSTRING_INDEX() returns incorrect value when index value is negative Created: 2019-03-12 Updated: 2019-03-16 Resolved: 2019-03-16 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | 1.2.3 |
| Fix Version/s: | 1.2.3 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Daniel Lee (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Sprint: | 2019-03 | ||||||||
| Description |
|
Build tested: 1.2.3-1 MariaDB [mytest]> create table t3 (c char(10)) engine=columnstore; MariaDB [mytest]> insert into t3 values ('aaaaaaaaaa'); MariaDB [mytest]> select c, SUBSTRING_INDEX(c,'a', -3) from t3;
-----------
----------- The query should return 'aa' instead. |
| Comments |
| Comment by Roman [ 2019-03-13 ] |
|
The problem was caused by the loop iterator counter and limiter types change(int64_t -> size_t). When negative values is used as the third argument to SUBSTRING_INDEX then loop limiter becomes close to max(size_t) and function returns an initial string. |
| Comment by Roman [ 2019-03-13 ] |
|
Please review the change. |
| Comment by Daniel Lee (Inactive) [ 2019-03-16 ] |
|
Build verified: 1.2.3-1 |