summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-01-03 19:22:30 +0100
committerSergei Golubchik <serg@mariadb.org>2022-01-26 18:43:06 +0100
commitae8600d514776cd697218b73924e846391c08fd8 (patch)
treea34b57f28e66a3427eeb3731641c47c480e1787a
parent918f524490f413d17d51eb2b81a0a2521caf30c1 (diff)
downloadmariadb-git-ae8600d514776cd697218b73924e846391c08fd8.tar.gz
MDEV-27408 DESC index on a Mroonga table causes wrong order of result set
disallow descending indexes in mroonga
-rw-r--r--storage/mroonga/ha_mroonga.cpp8
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/index_desc.result9
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/index_desc.test15
3 files changed, 32 insertions, 0 deletions
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 83c2d15a36c..8e1c6f7f336 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -3844,6 +3844,14 @@ int ha_mroonga::storage_create_validate_index(TABLE *table)
KEY *key_info = &(table->s->key_info[i]);
// must be single column key
int key_parts = KEY_N_KEY_PARTS(key_info);
+ for (int j = 0; j < key_parts; j++) {
+ if (key_info->key_part[j].key_part_flag & HA_REVERSE_SORT) {
+ GRN_LOG(ctx, GRN_LOG_ERROR, "DESC indexes are not supported");
+ error = ER_CANT_CREATE_TABLE;
+ my_message(error, "DESC indexes are not supported", MYF(0));
+ DBUG_RETURN(error);
+ }
+ }
if (key_parts != 1) {
continue;
}
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_desc.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_desc.result
new file mode 100644
index 00000000000..350ad0a3eeb
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_desc.result
@@ -0,0 +1,9 @@
+#
+# MDEV-27408 DESC index on a Mroonga table causes wrong order of result set
+#
+create table t1 (a int, key(a desc));
+ERROR HY000: DESC indexes are not supported
+show warnings;
+Level Code Message
+Error 1005 DESC indexes are not supported
+Warning 1030 Got error 1005 "Unknown error 1005" from storage engine Mroonga
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_desc.test
new file mode 100644
index 00000000000..388497bb0c3
--- /dev/null
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_desc.test
@@ -0,0 +1,15 @@
+--source ../../include/mroonga/have_mroonga.inc
+
+--echo #
+--echo # MDEV-27408 DESC index on a Mroonga table causes wrong order of result set
+--echo #
+
+--error ER_CANT_CREATE_TABLE
+create table t1 (a int, key(a desc));
+show warnings;
+#show create table t1;
+#insert into t1 values (1),(3),(2);
+#select * from t1 order by a;
+#drop table t1;
+
+--source ../../include/mroonga/have_mroonga_deinit.inc