Commit d6ab34b3 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-27396 DESC index attribute remains in Archive table definition, despite...

MDEV-27396 DESC index attribute remains in Archive table definition, despite being apparently ignored

disallow descending indexes in archive
parent 4c6e8fc5
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
DROP TABLE if exists t1,t2,t3,t4,t5,t6;
SET default_storage_engine=ARCHIVE; SET default_storage_engine=ARCHIVE;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
...@@ -12881,6 +12880,9 @@ show warnings; ...@@ -12881,6 +12880,9 @@ show warnings;
Level Code Message Level Code Message
Error 1194 Table 't1' is marked as crashed and should be repaired Error 1194 Table 't1' is marked as crashed and should be repaired
drop table t1; drop table t1;
#
# temporary archive
#
create temporary table t1 (a int) engine=archive; create temporary table t1 (a int) engine=archive;
insert t1 values (1),(2),(3); insert t1 values (1),(2),(3);
select * from t1; select * from t1;
...@@ -12906,3 +12908,14 @@ t1 CREATE TEMPORARY TABLE `t1` ( ...@@ -12906,3 +12908,14 @@ t1 CREATE TEMPORARY TABLE `t1` (
`b` varchar(10) DEFAULT NULL `b` varchar(10) DEFAULT NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
drop table t1; drop table t1;
#
# End of 10.0 tests
#
#
# MDEV-27396 DESC index attribute remains in Archive table definition, despite being apparently ignored
#
create table t (t int auto_increment, key (t desc)) engine=archive;
ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options")
#
# End of 10.8 tests
#
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
--disable_warnings
DROP TABLE if exists t1,t2,t3,t4,t5,t6;
--enable_warnings
SET default_storage_engine=ARCHIVE; SET default_storage_engine=ARCHIVE;
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
...@@ -1770,9 +1766,9 @@ select * from t1; ...@@ -1770,9 +1766,9 @@ select * from t1;
show warnings; show warnings;
drop table t1; drop table t1;
# --echo #
# temporary archive --echo # temporary archive
# --echo #
create temporary table t1 (a int) engine=archive; create temporary table t1 (a int) engine=archive;
insert t1 values (1),(2),(3); insert t1 values (1),(2),(3);
select * from t1; select * from t1;
...@@ -1782,3 +1778,16 @@ select * from t1; ...@@ -1782,3 +1778,16 @@ select * from t1;
show create table t1; show create table t1;
drop table t1; drop table t1;
--echo #
--echo # End of 10.0 tests
--echo #
--echo #
--echo # MDEV-27396 DESC index attribute remains in Archive table definition, despite being apparently ignored
--echo #
--error ER_CANT_CREATE_TABLE
create table t (t int auto_increment, key (t desc)) engine=archive;
--echo #
--echo # End of 10.8 tests
--echo #
...@@ -785,7 +785,9 @@ int ha_archive::create(const char *name, TABLE *table_arg, ...@@ -785,7 +785,9 @@ int ha_archive::create(const char *name, TABLE *table_arg,
{ {
Field *field= key_part->field; Field *field= key_part->field;
if (!(field->flags & AUTO_INCREMENT_FLAG)) if (!(field->flags & AUTO_INCREMENT_FLAG) ||
key_part->key_part_flag & HA_REVERSE_SORT)
{ {
error= HA_WRONG_CREATE_OPTION; error= HA_WRONG_CREATE_OPTION;
DBUG_PRINT("ha_archive", ("Index error in creating archive table")); DBUG_PRINT("ha_archive", ("Index error in creating archive table"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment