[MDEV-27434] DESC attribute does not work with auto-increment on secondary column of multi-part index Created: 2022-01-06  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

 Description   

CREATE TABLE t (a INT AUTO_INCREMENT, b INT, UNIQUE(b,a DESC)) ENGINE=MyISAM;
INSERT IGNORE INTO t (b) VALUES (10),(10),(10);
 
SELECT * FROM t;
 
# Cleanup
DROP TABLE t;

preview-10.8-MDEV-13756-desc-indexes 43444ff5

INSERT IGNORE INTO t (b) VALUES (10),(10),(10);
Warnings:
Warning	1062	Duplicate entry '10-2' for key 'b'
SELECT * FROM t;
a	b
2	10
1	10

Without the DESC attribute, the value of `a` would continue to be auto-incremented, no warnings/errors would occur upon INSERT, and there would be 3 values in the table at the end:

Expected result (apart from sorting in SELECT)

INSERT IGNORE INTO t (b) VALUES (10),(10),(10);
SELECT * FROM t;
a	b
1	10
2	10
3	10

Also reproducible with Aria.


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