1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-27434 DESC attribute does not work with auto-increment on secondary column of multi-part index

when searching for the last auto-inc value, it's HA_READ_PREFIX_LAST for
the ASC keypart, but HA_READ_PREFIX for the DESC one

also fixes MDEV-27585
This commit is contained in:
Sergei Golubchik
2022-01-08 15:08:21 +01:00
parent 9b6d2ad745
commit 72b5b8b2e3
6 changed files with 88 additions and 12 deletions

View File

@ -1,6 +1,5 @@
call mtr.add_suppression("Can't find record in '.*'");
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
drop table if exists t1,t2,t3;
SET SQL_WARNINGS=1;
CREATE TABLE t1 (
STRING_DATA char(255) default NULL,
@ -2776,5 +2775,26 @@ bar
NULL
drop table t;
#
# MDEV-27434 DESC attribute does not work with auto-increment on secondary column of multi-part index
#
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;
a b
3 10
2 10
1 10
drop table t;
#
# MDEV-27585 Auto-increment on secondary column increments unexpectedly with DESC key
#
create table t (c char(16), i int auto_increment, index (c,i desc)) engine=myisam collate latin1_swedish_ci;
insert into t (c) values ('ä'),('a');
select hex(c),c,i from t order by c, i;
hex(c) c i
61 a 1
C3A4 ä 1
drop table t;
#
# End of 10.8 tests
#