Skip to content

Commit d6ab34b

Browse files
committed
MDEV-27396 DESC index attribute remains in Archive table definition, despite being apparently ignored
disallow descending indexes in archive
1 parent 4c6e8fc commit d6ab34b

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

mysql-test/suite/archive/archive.result

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
22
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
3-
DROP TABLE if exists t1,t2,t3,t4,t5,t6;
43
SET default_storage_engine=ARCHIVE;
54
CREATE TABLE t1 (
65
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -12881,6 +12880,9 @@ show warnings;
1288112880
Level Code Message
1288212881
Error 1194 Table 't1' is marked as crashed and should be repaired
1288312882
drop table t1;
12883+
#
12884+
# temporary archive
12885+
#
1288412886
create temporary table t1 (a int) engine=archive;
1288512887
insert t1 values (1),(2),(3);
1288612888
select * from t1;
@@ -12906,3 +12908,14 @@ t1 CREATE TEMPORARY TABLE `t1` (
1290612908
`b` varchar(10) DEFAULT NULL
1290712909
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
1290812910
drop table t1;
12911+
#
12912+
# End of 10.0 tests
12913+
#
12914+
#
12915+
# MDEV-27396 DESC index attribute remains in Archive table definition, despite being apparently ignored
12916+
#
12917+
create table t (t int auto_increment, key (t desc)) engine=archive;
12918+
ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options")
12919+
#
12920+
# End of 10.8 tests
12921+
#

mysql-test/suite/archive/archive.test

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
88
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
99

10-
--disable_warnings
11-
DROP TABLE if exists t1,t2,t3,t4,t5,t6;
12-
--enable_warnings
13-
1410
SET default_storage_engine=ARCHIVE;
1511
let $MYSQLD_DATADIR= `SELECT @@datadir`;
1612

@@ -1770,9 +1766,9 @@ select * from t1;
17701766
show warnings;
17711767
drop table t1;
17721768

1773-
#
1774-
# temporary archive
1775-
#
1769+
--echo #
1770+
--echo # temporary archive
1771+
--echo #
17761772
create temporary table t1 (a int) engine=archive;
17771773
insert t1 values (1),(2),(3);
17781774
select * from t1;
@@ -1782,3 +1778,16 @@ select * from t1;
17821778
show create table t1;
17831779
drop table t1;
17841780

1781+
--echo #
1782+
--echo # End of 10.0 tests
1783+
--echo #
1784+
1785+
--echo #
1786+
--echo # MDEV-27396 DESC index attribute remains in Archive table definition, despite being apparently ignored
1787+
--echo #
1788+
--error ER_CANT_CREATE_TABLE
1789+
create table t (t int auto_increment, key (t desc)) engine=archive;
1790+
1791+
--echo #
1792+
--echo # End of 10.8 tests
1793+
--echo #

storage/archive/ha_archive.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,9 @@ int ha_archive::create(const char *name, TABLE *table_arg,
785785
{
786786
Field *field= key_part->field;
787787

788-
if (!(field->flags & AUTO_INCREMENT_FLAG))
788+
if (!(field->flags & AUTO_INCREMENT_FLAG) ||
789+
key_part->key_part_flag & HA_REVERSE_SORT)
790+
789791
{
790792
error= HA_WRONG_CREATE_OPTION;
791793
DBUG_PRINT("ha_archive", ("Index error in creating archive table"));

0 commit comments

Comments
 (0)