summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-01-24 18:38:12 +0100
committerSergei Golubchik <serg@mariadb.org>2022-01-26 18:43:06 +0100
commit4c6e8fc572e5a1dbe100f20d471be65aecbb5225 (patch)
tree3b5283ce471ac61f635d30a5b42c25abfc0f6f3d
parentae8600d514776cd697218b73924e846391c08fd8 (diff)
downloadmariadb-git-4c6e8fc572e5a1dbe100f20d471be65aecbb5225.tar.gz
MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results
disallow descending indexes in connect
-rw-r--r--storage/connect/ha_connect.cc9
-rw-r--r--storage/connect/mysql-test/connect/r/index.result9
-rw-r--r--storage/connect/mysql-test/connect/t/index.test10
3 files changed, 28 insertions, 0 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 17e50b5c56b..d175816bf67 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -1812,6 +1812,12 @@ PIXDEF ha_connect::GetIndexInfo(TABLE_SHARE *s)
pn= (char*)kp.key_part[k].field->field_name.str;
name= PlugDup(g, pn);
+ if (kp.key_part[k].key_part_flag & HA_REVERSE_SORT)
+ {
+ strcpy(g->Message, "Descending indexes are not supported");
+ xdp->Invalid= true;
+ }
+
// Allocate the key part description block
kpp= new(g) KPARTDEF(name, k + 1);
kpp->SetKlen(kp.key_part[k].length);
@@ -6944,6 +6950,9 @@ int ha_connect::create(const char *name, TABLE *table_arg,
strcpy(g->Message, "Compressed tables are not indexable");
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_UNSUPPORTED;
+ } else if (xdp->Invalid) {
+ my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
+ rc= HA_ERR_UNSUPPORTED;
} else if (GetIndexType(type) == 1) {
PDBUSER dup= PlgGetUser(g);
PCATLG cat= (dup) ? dup->Catalog : NULL;
diff --git a/storage/connect/mysql-test/connect/r/index.result b/storage/connect/mysql-test/connect/r/index.result
index bffaaecc785..c156e10749e 100644
--- a/storage/connect/mysql-test/connect/r/index.result
+++ b/storage/connect/mysql-test/connect/r/index.result
@@ -139,3 +139,12 @@ DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+#
+# MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results
+#
+CREATE TABLE t1 (
+id INT,
+f VARCHAR(32),
+PRIMARY KEY (id DESC)
+) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='emp.txt';
+ERROR HY000: Descending indexes are not supported
diff --git a/storage/connect/mysql-test/connect/t/index.test b/storage/connect/mysql-test/connect/t/index.test
index 5e913582734..b631236832d 100644
--- a/storage/connect/mysql-test/connect/t/index.test
+++ b/storage/connect/mysql-test/connect/t/index.test
@@ -78,6 +78,16 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+--echo #
+--echo # MDEV-27591 Connect tables (FIX/DOS) don't work with DESC keys - wrong results
+--echo #
+--error ER_UNKNOWN_ERROR
+CREATE TABLE t1 (
+ id INT,
+ f VARCHAR(32),
+ PRIMARY KEY (id DESC)
+) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='emp.txt';
+
#
# Clean up
#