[MDEV-30072] Wrong ORDER BY for a partitioned prefix key + NOPAD Created: 2022-11-22 Updated: 2023-04-06 Resolved: 2023-04-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Character Sets, Partitioning |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.11, 11.0 |
| Fix Version/s: | 11.1.1, 10.11.3, 11.0.2, 10.4.29, 10.5.20, 10.6.13, 10.7.8, 10.8.8, 10.9.6, 10.10.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | regression-10.4 | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
I create a table:
Now I run ORDER BY queries:
Looks good so far. Now I alter the table changing the full key to a prefix key:
And return ORDER BY queries again:
Notice the order changed to opposite. |
| Comments |
| Comment by Alexander Barkov [ 2022-11-22 ] | |||||||||||||||||||||||||||||||
|
The problem was caused by
This change was OK for PAD SPACE collations and improved performance for VARCHAR/TEXT columns. But it appeared not to be correct for NOPAD collations - it changed the behaviour to wrong. It seems, to combine both performance and correct behavior, instead of one function strnncollsp_nchars() we need two separate functions:
Both should truncate too long strings. | |||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2022-11-23 ] | |||||||||||||||||||||||||||||||
|
Also repeatable with TEXT:
|