mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-27406 Index on a HEAP table retains DESC attribute despite being hash
just like in SHOW KEYS, suppress DESC in SHOW CREATE if not HA_READ_ORDER
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
|
||||
insert into t1 values(1,1),(2,2),(3,3),(4,4);
|
||||
delete from t1 where a=1 or a=0;
|
||||
@@ -467,4 +466,23 @@ SELECT * FROM t1 WHERE c1='bar2';
|
||||
c1
|
||||
bar2
|
||||
DROP TABLE t1;
|
||||
End of 5.5 tests
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
# MDEV-27406 Index on a HEAP table retains DESC attribute despite being hash
|
||||
#
|
||||
create table t1 (a int, key(a desc)) engine=memory;
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
|
||||
t1 1 a 1 a NULL 0 NULL NULL YES HASH NO
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
KEY `a` (`a`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
#
|
||||
# End of 10.8 tests
|
||||
#
|
||||
|
@@ -2,10 +2,6 @@
|
||||
# Test of heap tables.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
|
||||
insert into t1 values(1,1),(2,2),(3,3),(4,4);
|
||||
delete from t1 where a=1 or a=0;
|
||||
@@ -346,4 +342,18 @@ explain SELECT * FROM t1 WHERE c1='bar2';
|
||||
SELECT * FROM t1 WHERE c1='bar2';
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27406 Index on a HEAP table retains DESC attribute despite being hash
|
||||
--echo #
|
||||
create table t1 (a int, key(a desc)) engine=memory;
|
||||
show index from t1;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.8 tests
|
||||
--echo #
|
||||
|
@@ -2369,7 +2369,8 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
||||
packet->append_parenthesized((long) key_part->length /
|
||||
key_part->field->charset()->mbmaxlen);
|
||||
}
|
||||
if (key_part->key_part_flag & HA_REVERSE_SORT)
|
||||
if (table->file->index_flags(i, j, 0) & HA_READ_ORDER &&
|
||||
key_part->key_part_flag & HA_REVERSE_SORT) /* same in SHOW KEYS */
|
||||
packet->append(STRING_WITH_LEN(" DESC"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user