[MDEV-27407] Different ASC/DESC index attributes on MERGE and underlying table can cause wrong results Created: 2022-01-02  Updated: 2022-01-26  Resolved: 2022-01-26

Status: Closed
Project: MariaDB Server
Component/s: Server, Storage Engine - MyISAM
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   

Currently MERGE and underlying MyISAM tables are allowed to have different ASC/DESC attributes on corresponding indexes. It can cause wrong results, at least for ORDER BY:

create or replace table t (a int, key(a desc)) engine=MyISAM;
create or replace table tm (a int, key(a)) engine=Merge union(t);
insert into t values (1),(5),(3);
 
# From the underlying table -- OK
select * from t force index for order by (a) order by a;
# From the MERGE table -- not OK
select * from tm force index for order by (a) order by a;
 
# Cleanup
drop table tm, t;

preview-10.8-MDEV-13756-desc-indexes 49b38c82a

select * from tm force index for order by (a) order by a;
a
5
3
1


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