[MDEV-27330] Wrong sorting order with DESC index and empty strings in MyISAM/Aria table Created: 2021-12-21  Updated: 2022-01-26  Resolved: 2022-01-26

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: N/A
Fix Version/s: 10.8.1

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-13756 Implement descending index: KEY (a DE... Closed
Relates
relates to MDEV-27303 Table corruption after insert into a ... Closed

 Description   

CREATE TABLE t (id int, c char(128) NOT NULL, KEY (c DESC)) ENGINE=MyISAM CHARSET latin1;
INSERT INTO t VALUES (1,''),(2,'foo'),(3,''),(4,'bar');
 
SELECT c FROM t ORDER BY c;
 
# Cleanup
DROP TABLE t;

preview-10.8-MDEV-13756-desc-indexes 47c18283

MariaDB [test]> SELECT c FROM t ORDER BY c;
+-----+
| c   |
+-----+
| bar |
| foo |
|     |
|     |
+-----+
4 rows in set (0.000 sec)

So, the empty strings go last, contrary to the expectation.
Reproducible with MyISAM and Aria.
Not reproducible with InnoDB.



 Comments   
Comment by Sergei Golubchik [ 2021-12-21 ]

pushed into preview-10.8-MDEV-13756-desc-indexes

Generated at Thu Feb 08 09:52:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.